Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Make a GUI teleport a player?

Asked by
bloxxyz 274 Moderation Voter
10 years ago

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

Log in to vote
1
Answered by
1N0body 206 Moderation Voter
10 years ago

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

0
that was helpful diego_daboss1134 0 — 4y
Ad

Answer this question