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

a button that teleports the player when pressed?

Asked by 3 years ago
Edited 3 years ago

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

Log in to vote
-1
Answered by 3 years ago
Edited 3 years ago

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.

0
doesn't work, with or without the spaces (spaces are supposed to be there, its on the wiki, but I did try both) Welovegod1029384756 25 — 3y
0
Hmm ill test it myself then! PatrykWalat 4 — 3y
0
In that case Ill try make a model for you and Ill send the link PatrykWalat 4 — 3y
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 PatrykWalat 4 — 3y
View all comments (4 more)
0
Scrap this, I did it wrong. Let me re-write it completely PatrykWalat 4 — 3y
0
No no no I did it wrong I thought it wasnt possible but I didnt even write the position into the script XD PatrykWalat 4 — 3y
0
it works now, ty! big part of my project, this really helped Welovegod1029384756 25 — 3y
0
No problem feel free to ask me anything else! PatrykWalat 4 — 3y
Ad

Answer this question