Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pos = CFrame.new(-462, 44, 46)
- --where you want the seats to go,
- --for finding positions i recommend using infinite yield's copypos command
- --For random coordinates
- Random = true
- --if the script stops for some reason, try sitting in a seat
- --for random corodinates
- --make sure the minimum is greater than maximum
- minimumXcoordinate = -485
- minimumYcoordinate = 44
- minimumZcoordinate = 38
- maximumXcoordinate = -462
- maximumYcoordinate = 45
- maximumZcoordinate = 63
- --
- chr = game.Players.LocalPlayer.Character
- TPEvent = workspace.Events.Teleport
- chr.Humanoid.JumpPower = 0
- gui = Instance.new("ScreenGui", game.Players.LocalPlayer.PlayerGui)
- frame = Instance.new("Frame", gui)
- txt = Instance.new("TextLabel", frame)
- txt2 = Instance.new("TextLabel", frame)
- button = Instance.new("TextButton", frame)
- gui.Name = "replacemente"
- button.Text = "Click to sit - for debugging"
- frame.Position = UDim2.new(0.5, 0, 0.5, 200)
- txt2.Position = UDim2.new(0.5, 0, 0.5, -50)
- button.Position = UDim2.new(0.5, -100, 0.5, -25)
- button.Size = UDim2.new(0, 200, 0, 10)
- if not _G.ScriptAlrOpen then
- _G.ScriptAlrOpen = true
- else
- button:Destroy()
- txt2:Destroy()
- txt.Position = UDim2.new(0.5, 0, 0.5, -75)
- txt.Text = "Script already open/done"
- wait(1.5)
- gui:Destroy()
- return end
- button.MouseButton1Click:Connect(function()
- chr.Humanoid.Sit = true
- end)
- seats = {}
- for i,v in pairs(workspace:GetDescendants()) do
- if v:isA("Seat") then table.insert(seats, v) end
- end
- num = 0
- for i,v in pairs(workspace:GetDescendants()) do
- if Random then
- x = math.random(minimumXcoordinate, maximumXcoordinate)
- y = math.random(minimumYcoordinate, maximumYcoordinate)
- z = math.random(minimumZcoordinate, maximumZcoordinate)
- pos = CFrame.new(x, y, z)
- end
- if v:isA("Seat") and v.Name ~= "movedchaiir" and v.CanTouch then
- v.Name = "movedchaiir"
- --check if its already being sat in
- if v:FindFirstChild("SeatWeld") then print("TEST")
- task.spawn(function() --basically just waits until a seat isnt being sat in
- firetouchinterest(chr.HumanoidRootPart, v, 0)
- repeat wait(.05) firetouchinterest(chr.HumanoidRootPart, v, 0) until chr.Humanoid.Sit == true
- TPEvent:FireServer(pos)
- repeat wait() until v:GetPropertyChangedSignal("Position")
- chr.Humanoid.JumpPower = 3
- chr.Humanoid.Jump = true
- wait(.05)
- chr.Humanoid.JumpPower = 0
- firetouchinterest(chr.HumanoidRootPart, v, 1)
- v.CanTouch = false --so you dont sit on it again
- end)
- else
- -- fire touch interest
- firetouchinterest(chr.HumanoidRootPart, v, 0)
- firetouchinterest(chr.HumanoidRootPart, v, 0)
- wait(.03)
- --wait until the seat is sat on
- txt.Text = "Waiting for sit"
- repeat wait(.077) firetouchinterest(chr.HumanoidRootPart, v, 0) until chr.Humanoid.Sit == true
- --fire tp event
- TPEvent:FireServer(pos)
- txt.Text = "Waiting for position change"
- repeat wait() until v:GetPropertyChangedSignal("Position")
- chr.Humanoid.JumpPower = 3
- chr.Humanoid.Jump = true
- wait(.05)
- chr.Humanoid.JumpPower = 0
- firetouchinterest(chr.HumanoidRootPart, v, 1)
- v.CanTouch = false --so you dont sit on it again
- wait(.02)
- num = num+1
- txt2.Text = "Seats moved: "..num.."/"..#seats
- end
- end
- end
- txt.Text = "All seats moved: "..num.."/"..#seats
- chr.Humanoid.JumpPower = 50
- wait(1.5)
- gui:Destroy()
- for i,v in pairs(workspace:GetDescendants()) do
- if v:isA("Seat") then v.CanTouch = true end
- end
Add Comment
Please, Sign In to add comment