Hi! I am trying to teleport a player when the press on the button to a part in the game. Its working on a ScreenGui but not on the SurfaceGui.
I’m using a local script.
wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function helpme()
if not debounce then
debounce = true
LowerTorso = player.Character.LowerTorso
LowerTorso.CFrame = game.Workspace.part.CFrame -- change the "part" to where ever you want player to go
wait(0)
end
end
button.MouseButton1Click:connect(helpme)
while true do wait()
debounce = false
wait(0)
end
This is really annoying. Can someone help me.
Thanks
You Can Use PlayerCharacter:MoveTo(Vecter3Position)
Here is a Simple Code:
local Player = game.Players.LocalPlayer
local Button = script.Parent
local CoolDown = false
local function Teleport(Position)
if CoolDown then return end
CoolDown = true
Player.Character:MoveTo(Position) -- Move The Player's Character To The Position
wait(5) -- CoolDown Time
CoolDown = false
end
Button.MouseButton1Click:connect(function()
Teleport(workspace.part.Position) -- Use a Vector3 Position.
end)