Still have questions? Join our Discord server and get real time help.
Log in to vote

Why won't my teleport GUI work properly?

Asked by
JipSea 23
4 months ago

I have a game where you can click different checkpoints in a GUI to teleport throughout the map, However; it keeps teleporting players on top of roofs, etc.

I have read about CFRAME's but cannot get it to work properly.

Please help!

local self = script.Parent;
    local Player = game.Players.LocalPlayer;
    local Character = Player.Character or Player.CharacterAdded:wait();

        Character:MoveTo(, 37.644, -119.341));

Thank You.

2 answers

Log in to vote
Answered by 4 months ago

You must use a local script. Not sure why but the first answer make me feel like your using a serverscript. Also the local script must be inside the textbutton GUI.

script.Parent.MouseButton1Click:Connect(function() -- When MouseButton1 (L Mouse) clicked then function below code
    local plr = game.Players.LocalPlayer -- Getting LocalPlayer (The client which is the player probably you when testing)
    local char = plr.Character -- Getting plr Character
    char:FindFirstChild("HumanoidRootPart").CFrame =,0,0) -- Set your CFrame position
end) -- Nihao I am chinese

Comment if you dont understand.

Log in to vote
Answered by 4 months ago

Make sure its a script, also you don't have any touch intrest in your script.

Put this at the very top of the script, and the second line at the very bottom

function onTouched(hit)
Also might wanna make a few changes when you do make this a script, like not reffering to localplayer. ifreakinlostmyacount 52 — 4mo

Answer this question