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

Help with a Teleport Script?

I need help with this teleport script.

script.Parent.MouseButton1Click:connect(function(hit)
    local player 

= hit.Parent
    if player then
        game:GetService("TeleportService"):Teleport(player, 254676560)
    end
end)

4 comments

0

I'm in mobile rift now but for 1 thing your top line is a connection so move your top line to the very bottom

0

I'm in mobile rift now but for 1 thing your top line is a connection so move your top line to the very bottom

0

Ignore the last 2 comments

0

Super i never heard if my answer worked:3

3 answers

Hi I'm on mobile so if it confusing I'm Srry can't really type in the code block good on mobile I also can't test it but it should work.

script.Parent.ClickDetector.MouseClick:connect(function(player) --You want to have the script identify the player here.

    wait(4) --this gives us a wait before we continue

    

    if player then -- calling from the function above 

        game:GetService("TeleportService"):Teleport(165643174, player) -- this teleports the player

    end
end)

Hope this helped let me know if it did.

1 comment

0

Ok is there a click detector in the part because the script should work but there must be a click detector to work

It didnt Work but thanks for trying :D

6 comments

0

Hmmm

0

Ok is there a click detector in the part the script should work but there must be a click detector in the part

0

If t works please let me know and it accept the answer if it did

0

Its not a Part its a GUI

0

Whoops Srry I meant GUI I was helping some earlier with clickin. A part so I got confused but put still put a click detector in the GUI Srry I didn't put that in my answer I figured u already had a click detected so put a click detector in the GUI

0

Also let me know if t worked:3

function onButtonClicked() local player = game.Players.LocalPlayer if player then game:GetService("TeleportService"):Teleport(254676560, player) end end

script.Parent.MouseButton1Click:connect(onButtonClicked)

Make sure this is in a local script not a script. LocalScripts is different from regular Scripts as they do not run server-side, but instead, perform their actions on the client.

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