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)
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)
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)
So, clickdetector only works on script and not local scripts?
This discussion is preserved as it was. New answers, comments, and votes are closed.
1 comment
A localscript will only run local to a player. Meaning it must be a child of the player or the character.