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

What is wrong with this script?

I made this script using a click detector to teleport me to a game (like TMM, etc.)

s = game:service("TeleportService")
id = 152594797

function onClicked()
s:Teleport(id)
end

script.Parent.ClickDetector:connect(onClicked)

1 comment

0

A localscript will only run local to a player. Meaning it must be a child of the player or the character.

1 answer

You are not specifying a player. You have to give the Teleport method the player unless it is a localscript. Which it should not be if you are using a ClickDetector.

s = game:service("TeleportService")
id = 152594797

function onClicked(player)
s:Teleport(id,player)
end

script.Parent.ClickDetector:connect(onClicked)

1 comment

0

So, clickdetector only works on script and not local scripts?

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