Hi so I wanted to make a teleport script by a ui but it dosen’t work.
wait(0)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
LowerTors = player.Character.LowerTorso
LowerTors.CFrame = game.Workspace.Train1Seat.CFrame
end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(0)
end
First of all, can you please make it so that we can read the code. Secondly, what is the error. This is the things that I hate to see when people is asking the community to solve problems without enough informations.
button = script.Parent
player = button.Parent.Parent.Parent
local debounce = false
function teleport()
if debounce ~= true then
debounce = true
player.Character:MoveTo(Vector3) --Replace vector3 with the position of your train seat
end
end
button.MouseButton1Click:Connect(teleport)
teleport()
end
while true do
if debounce == false then
wait(0.05)
debounce = true
end
end
wait(0)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
player.Character.HumanoidRootPart.CFrame = workspace.Train1Seat.CFrame
end
end
button.MouseButton1Click:Connect(teleport)
while true do wait()
debounce = false
wait(0)
end