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

How to make a player teleport when they click on your gui?

Asked by 7 years ago

I'm trying to make my player teleport (To another place) when they click the gui i'm completely confused on what to do so i have no code snippets. i know how to teleport them to a new place but not how to do it when they click the gui

2 answers

Log in to vote
0
Answered by 7 years ago

This isnt a forums for people making you scripts, this is intended for people to help you with your scirpts. Atleast give it a shot. If you really want to be lazy, then heres the source code to do it:

script.Parent.MouseButton1Click:connect(function(player)
    --code to teleport them
end)

If you are actually extremely lazy then 1) laziness will get you no where. 2) here you go:

local position = positionthatyouwantplayerstoteleporto


script.Parent.MouseButton1Click:connect(function(player)
    player.Character.Torso.CFrame = CFrame.new(position)
    print'player teleported'
end)
0
FYI, you can also do "player.Character:MoveTo(position)" instead of "player.Character.Torso.CFrame = CFrame.new(position)" ObscureIllusion 352 — 7y
0
i'm not lazy its just i'm usually good at scripting but i was totally confused sorry about that second of all how do you even put the script on there idk how arrowman888 69 — 7y
0
If it's just me or.. this doesn't work. TheePBHST 154 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Use the wiki my friend :) http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Click

0
this did not work D: arrowman888 69 — 7y
0
Script? tacktic2010 70 — 7y

Answer this question