Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local closet = script.Parent.Parent.Parent
- local prompt = script.Parent
- local promptExit = script.Parent.Parent.exit
- local used = closet.used
- local usedBy = closet.usedBy
- local humanoid = closet:WaitForChild("Humanoid")
- local humPosX = humanoid.Parent.HumanoidRootPart.Position.X
- local humPosY = humanoid.Parent.HumanoidRootPart.Position.Y
- local humPosZ = humanoid.Parent.HumanoidRootPart.Position.Z
- local playerHum
- local playerX
- local playerY
- local playerZ
- local username
- prompt.Triggered:Connect(function(player)
- username = player.Name
- if used.Value == false and usedBy.Value == "" then
- playerX = player.Character.HumanoidRootPart.Position.X
- playerY = player.Character.HumanoidRootPart.Position.Y
- playerZ = player.Character.HumanoidRootPart.Position.Z
- playerHum = player.Character.HumanoidRootPart
- playerHum.Position = Vector3.new(humPosX, humPosY, humPosZ)
- end
- end)
- promptExit.Triggered:Connect(function(player)
- if used.Value == true and usedBy.Value == username then
- playerHum.Position = Vector3.new(playerX, playerY, playerZ)
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement