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

What is wrong with this script?

Asked by 9 years ago

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)

0
A localscript will only run local to a player. Meaning it must be a child of the player or the character. NotsoPenguin 705 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

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)

0
So, clickdetector only works on script and not local scripts? User#5689 -1 — 9y
Ad

Answer this question