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

Make a GUI teleport a player?

I don't want a script created for me, just asking what I would need to know to create this? Or maybe how to make any built in function teleport a player? I feel as if it has something to do with MoveTo, but I'm not sure. Thanks.

1 answer

✓ Accepted answer

If you want to move a player to a designated position you could use this simple method:

target  = CFrame.new(0,0,0) -- position
playerCharacter.Torso.CFrame = target

To do it with GUI's it's simple, you could do it like this:

button =  script.Parent -- the GUI button
location = CFrame.new(0,0,0) -- target location !!This is not a Vector3.new() location its [Coordinate frame](http://wiki.roblox.com/index.php?title=Cframe)

button.MouseButton1Down:connect(function ()  -- Calling the event
plrgui = button.Parent.Parent -- It's the playerGui location where the screengui is located
player = plrgui.Parent -- the player
player.Character.Torso.CFrame = location -- player's character location will be set to the designated location
end)

If you want it to teleport to another place, using the GUI, you could do it like this:

button = script.Parent -- the button
button.MouseButton1Down:connect(function ()  --calling the event
plrgui = button.Parent.Parent -- the playerGui like in the last code given.
player = plrgui.Parent
id = 'PLACE ID HERE' -- the place id
game:GetService('TeleportService'):Teleport(id, player) -- it will teleport the player to the designated ID.
end)

You might want to see this:

TeleportService

Teleport

1 comment

0

that was helpful

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