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

Error when useing place teleport script?

I added a Place teleport Gui and i tested it ingame studio and it works fine But when i go to the place itself it gives me a http://imgur.com/KMY6t8Q

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

function onClicked()
s:Teleport(id)
end

script.Parent.MouseButton1Click:connect(onClicked)

5 comments

0

Please place script in a proper code block. Anyway, I believe there's a second condition for the Teleport method that requires the player. Add the local player as the second condition to the Teleport command.

0

How do i put it in a code block?

0

When editing or asking a question there'll be a Lua icon next to the other icons. Click it and it will create two ~~~~~'s, put your code inbetween them.

0

Okay Fixed

0

This source code must be in a LocalScript.

1 answer

Explanation: The reason it worked in studio solo test mode is because it runs all scripts as if they were local and the way your attempting to teleport them would only work if the script was ran local, this is with the assumption your running your current code in a regular script.

Change the script to a local script and use this code.

function onClicked()
	game:GetService("TeleportService"):Teleport(161936731)
end

script.Parent.MouseButton1Click:connect(onClicked)

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