Advertisement
Arm4GeDon

Closet Thing

Oct 15th, 2022
813
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.07 KB | None | 0 0
  1. local closet = script.Parent.Parent.Parent
  2. local prompt = script.Parent
  3. local promptExit = script.Parent.Parent.exit
  4.  
  5. local used = closet.used
  6. local usedBy = closet.usedBy
  7.  
  8. local humanoid = closet:WaitForChild("Humanoid")
  9.  
  10. local humPosX = humanoid.Parent.HumanoidRootPart.Position.X
  11. local humPosY = humanoid.Parent.HumanoidRootPart.Position.Y
  12. local humPosZ = humanoid.Parent.HumanoidRootPart.Position.Z
  13.  
  14. local playerHum
  15.  
  16. local playerX
  17. local playerY
  18. local playerZ
  19.  
  20. local username
  21.  
  22. prompt.Triggered:Connect(function(player)
  23.     username = player.Name
  24.     if used.Value == false and usedBy.Value == "" then
  25.         playerX = player.Character.HumanoidRootPart.Position.X
  26.         playerY = player.Character.HumanoidRootPart.Position.Y
  27.         playerZ = player.Character.HumanoidRootPart.Position.Z
  28.         playerHum = player.Character.HumanoidRootPart
  29.         playerHum.Position = Vector3.new(humPosX, humPosY, humPosZ)
  30.     end
  31. end)
  32.  
  33. promptExit.Triggered:Connect(function(player)
  34.     if used.Value == true and usedBy.Value == username then
  35.         playerHum.Position = Vector3.new(playerX, playerY, playerZ)
  36.     end
  37. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement