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

Help with a Teleport Script?

Asked by 9 years ago

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)
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 iSvenDerp 233 — 9y
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 iSvenDerp 233 — 9y
0
Ignore the last 2 comments iSvenDerp 233 — 9y
0
Super i never heard if my answer worked:3 iSvenDerp 233 — 9y

3 answers

Log in to vote
0
Answered by
iSvenDerp 233 Moderation Voter
9 years ago

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.

0
Ok is there a click detector in the part because the script should work but there must be a click detector to work iSvenDerp 233 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

It didnt Work but thanks for trying :D

0
Hmmm iSvenDerp 233 — 9y
0
Ok is there a click detector in the part the script should work but there must be a click detector in the part iSvenDerp 233 — 9y
0
If t works please let me know and it accept the answer if it did iSvenDerp 233 — 9y
0
Its not a Part its a GUI supermanswaqq 65 — 9y
View all comments (2 more)
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 iSvenDerp 233 — 9y
0
Also let me know if t worked:3 iSvenDerp 233 — 9y
Log in to vote
0
Answered by 9 years ago

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.

Answer this question