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

Error when useing place teleport script?

Asked by 9 years ago

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)
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. M39a9am3R 3210 — 9y
0
How do i put it in a code block? CorvetteLegend 0 — 9y
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. drew1017 330 — 9y
0
Okay Fixed CorvetteLegend 0 — 9y
0
This source code must be in a LocalScript. Redbullusa 1580 — 9y

1 answer

Log in to vote
0
Answered by
Voltoxus 248 Moderation Voter
9 years ago

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)
Ad

Answer this question