Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

a button that teleports the player when pressed?

alright so. i'm trying to make a teleport gui for my game. i whipped up what i thought would work, using examples from the wiki, but it doesn't seem to work. it's a local script.

target = CFrame.new(-420, 94, 531)

function parentPressed()
	game.Workspace.Player.HumanoidRootPart.CFrame = target
end

script.Parent.MouseButton1Down:connect(parentPressed)

here it is. thank you in advance!

1 answer

✓ Accepted answer

Here try this: Put this script into the GUI button to teleport the player!

local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Click:connect(function()
plr.Character:MoveTo(Vector3.new(-420, 94, 531))  --Change the coordinates to location you want to move the player to.

end) 

Any questions feel free to ask. If it works the please accept my answer.

8 comments

0

doesn't work, with or without the spaces (spaces are supposed to be there, its on the wiki, but I did try both)

0

Hmm ill test it myself then!

0

In that case Ill try make a model for you and Ill send the link

0

I see the problem! The position isn't possible! You can't teleport a player to a place which isnt even real! In my opinion place a part where you want the player to get teleported to and copy and paste the position of that part into the script I gave you

0

Scrap this, I did it wrong. Let me re-write it completely

0

No no no I did it wrong I thought it wasnt possible but I didnt even write the position into the script XD

0

it works now, ty! big part of my project, this really helped

0

No problem feel free to ask me anything else!

This discussion is preserved as it was. New answers, comments, and votes are closed.