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

Could someone help me on a teleportation issue?

Asked by 10 years ago

Hierchy:

Sign

+Part

+Part

+Part

+Part

++ClickDetector

++Decal

++LocalScript

LocalScript Contents:

script.Parent.ClickDetector.MouseClick:connect(function()
    game:GetService("TeleportService"):Teleport(21916786)
end)

2 answers

Log in to vote
2
Answered by 10 years ago

On a hunch, because I don't really know the difference between local scripts and scripts, try putting that code into a script.

Another hunch is that you are not clicking the clickdetector, you are clicking the brick. Try:

script.Parent.MouseClick:connect(function()--Instead of clicking the clickdetector, we are clicking the parent of the script, or part.
    game:GetService("TeleportService"):Teleport(21916786)
end)

0
Actually, that's the way the ClickDetector works. You 'click' the ClickDetector, so that part is fine. infalliblelemon 145 — 10y
Ad
Log in to vote
1
Answered by 10 years ago

Put it in a normal script, LocalScripts run on Players, and can only be put in StarterGui or StarterPack.

Your script was fine, you just needed to add the actual Player part of it.

script.Parent.ClickDetector.MouseClick:connect(function(Player) --The player who clicked on the part
    game:GetService("TeleportService"):Teleport(21916786, Player)
end)

Answer this question