Hydasi

Life in Paradise - Teleport Chairs to Spawn

Jan 31st, 2023
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.56 KB | None | 0 0
  1. pos = CFrame.new(-462, 44, 46)
  2. --where you want the seats to go,
  3. --for finding positions i recommend using infinite yield's copypos command
  4.  
  5. --For random coordinates
  6. Random = true
  7.  
  8. --if the script stops for some reason, try sitting in a seat
  9.  
  10. --for random corodinates
  11. --make sure the minimum is greater than maximum
  12. minimumXcoordinate = -485
  13. minimumYcoordinate = 44
  14. minimumZcoordinate = 38
  15.  
  16. maximumXcoordinate = -462
  17. maximumYcoordinate = 45
  18. maximumZcoordinate = 63
  19. --
  20.  
  21. chr = game.Players.LocalPlayer.Character
  22. TPEvent = workspace.Events.Teleport
  23. chr.Humanoid.JumpPower = 0
  24.  
  25. gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
  26. frame = Instance.new("Frame", gui)
  27. txt = Instance.new("TextLabel", frame)
  28. txt2 = Instance.new("TextLabel", frame)
  29. button = Instance.new("TextButton", frame)
  30. gui.Name = "replacemente"
  31. button.Text = "Click to sit - for debugging"
  32. frame.Position = UDim2.new(0.5, 0, 0.5, 200)
  33. txt2.Position = UDim2.new(0.5, 0, 0.5, -50)
  34. button.Position = UDim2.new(0.5, -100, 0.5, -25)
  35. button.Size = UDim2.new(0, 200, 0, 10)
  36.  
  37. if not _G.ScriptAlrOpen then
  38. _G.ScriptAlrOpen = true
  39. else
  40. button:Destroy()
  41. txt2:Destroy()
  42. txt.Position = UDim2.new(0.5, 0, 0.5, -75)
  43. txt.Text = "Script already open/done"
  44. wait(1.5)
  45. gui:Destroy()
  46. return end
  47.  
  48. button.MouseButton1Click:Connect(function()
  49. chr.Humanoid.Sit = true
  50. end)
  51.  
  52. seats = {}
  53. for i,v in pairs(workspace:GetDescendants()) do
  54. if v:isA("Seat") then table.insert(seats, v) end
  55. end
  56. num = 0
  57.  
  58. for i,v in pairs(workspace:GetDescendants()) do
  59. if Random then
  60. x = math.random(minimumXcoordinate, maximumXcoordinate)
  61. y = math.random(minimumYcoordinate, maximumYcoordinate)
  62. z = math.random(minimumZcoordinate, maximumZcoordinate)
  63. pos = CFrame.new(x, y, z)
  64. end
  65. if v:isA("Seat") and v.Name ~= "movedchaiir" and v.CanTouch then
  66. v.Name = "movedchaiir"
  67. --check if its already being sat in
  68. if v:FindFirstChild("SeatWeld") then print("TEST")
  69. task.spawn(function() --basically just waits until a seat isnt being sat in
  70. firetouchinterest(chr.HumanoidRootPart, v, 0)
  71. repeat wait(.05) firetouchinterest(chr.HumanoidRootPart, v, 0) until chr.Humanoid.Sit == true
  72. TPEvent:FireServer(pos)
  73. repeat wait() until v:GetPropertyChangedSignal("Position")
  74. chr.Humanoid.JumpPower = 3
  75. chr.Humanoid.Jump = true
  76. wait(.05)
  77. chr.Humanoid.JumpPower = 0
  78. firetouchinterest(chr.HumanoidRootPart, v, 1)
  79. v.CanTouch = false --so you dont sit on it again
  80. end)
  81. else
  82. -- fire touch interest
  83. firetouchinterest(chr.HumanoidRootPart, v, 0)
  84. firetouchinterest(chr.HumanoidRootPart, v, 0)
  85. wait(.03)
  86. --wait until the seat is sat on
  87. txt.Text = "Waiting for sit"
  88. repeat wait(.077) firetouchinterest(chr.HumanoidRootPart, v, 0) until chr.Humanoid.Sit == true
  89. --fire tp event
  90. TPEvent:FireServer(pos)
  91. txt.Text = "Waiting for position change"
  92. repeat wait() until v:GetPropertyChangedSignal("Position")
  93. chr.Humanoid.JumpPower = 3
  94. chr.Humanoid.Jump = true
  95. wait(.05)
  96. chr.Humanoid.JumpPower = 0
  97. firetouchinterest(chr.HumanoidRootPart, v, 1)
  98. v.CanTouch = false --so you dont sit on it again
  99. wait(.02)
  100. num = num+1
  101. txt2.Text = "Seats moved: "..num.."/"..#seats
  102. end
  103. end
  104. end
  105. txt.Text = "All seats moved: "..num.."/"..#seats
  106. chr.Humanoid.JumpPower = 50
  107. wait(1.5)
  108. gui:Destroy()
  109. for i,v in pairs(workspace:GetDescendants()) do
  110. if v:isA("Seat") then v.CanTouch = true end
  111. end
Add Comment
Please, Sign In to add comment