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

Surface GUI Universe Teleport Button Help?

Asked by 8 years ago
Edited 8 years ago

I have tried tons of scripts but none will work for my SurfaceGUI on a simple part. I click it and nothing happens, nothing in the output too. I want it to teleport to a place in my game universe. Here is the code I've tried recently.

function onClicked(playerWhoClicked)
    local player = game.Players[playerWhoClicked]
    if player then
        game:GetService("TeleportService"):Teleport(512970811, player)
    end
end

0
If you post the code it would help us better answer your question.... yougottols1 420 — 8y
0
Edited. antlerer 33 — 8y
0
Did you connect the event? GoldenPhysics 474 — 8y
0
Um as far as I know, no. antlerer 33 — 8y
0
Well, that would be a problem. Check the wiki for connecting events. GoldenPhysics 474 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago
Edited 8 years ago
script.Parent.Button1Down:connect(function(playerWhoClicked)
    local player = game.Players[playerWhoClicked]
    if player then
        game.GetService("TeleportService"):Teleport(512970811,player)
    end
end)

This script assumes that the script is in the button

Ad

Answer this question