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

Universe Problem, only works in Test mode!?

Asked by 8 years ago

This script seems easier than it is to generate. Sadly I have yet to find the full problem.

function OnClick(mouse)
game:GetService("TeleportService"):Teleport(259945232)

end

script.Parent.ClickDetector.MouseClick:connect(OnClick)

It is in a normal script, I've tried it in a Local and it failed as well. Any suggestions?

1 answer

Log in to vote
1
Answered by 8 years ago

You have to tell the function who it's teleporting

We can do this easily, because ClickDetectors give us the player who clicked. In Local Scripts we don't need to do this, but in regular scripts we do.

-- Regular Script
function OnClick(plr)
    game:GetService("TeleportService"):Teleport(259945232,plr)
end

script.Parent.ClickDetector.MouseClick:connect(OnClick)

Good Luck!

If I helped, please don't forget to accept my answer.
0
How did you make the text smaller? TheDeadlyPanther 2460 — 8y
0
Use Hashtags. I used 6. One # is huge, 6 is small. User#11440 120 — 8y
Ad

Answer this question