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

Is it possible to make a universe teleporter script with a SurfaceGUI?

This is currently what I have right now

id = 364386074
TeleportService = game:GetService("TeleportService")
local holo = game.Workspace:FindFirstChild("Holo")


holo.SurfaceGui.ImageButton.MouseButton1Click:connect(function(plr)
	TeleportService:Teleport(id, plr)
end)

This does work in PlayTest, however, whenever I start up a server, it gives me the error that it attempted to index local holo (a nil value). This error doesn't really make sense to me, if someone can explain and help me make this script work that'd be great.

Also this is a LocalScript inside StarterPack.

1 answer

The most likely problem is that the Holo part is not loaded in yet when the script first runs. To fix this, you can try using WaitForChild.

local id = 364386074
local TeleportService = game:GetService("TeleportService")
local holo = game.Workspace:WaitForChild("Holo")

holo.SurfaceGui.ImageButton.MouseButton1Click:connect(function(plr)
    TeleportService:Teleport(id, plr)
end)

1 comment

0

That seems to have fixed that issue, but the actual teleport itself doesn't seem to work. The only thing it does is say "Teleport failed: Previous teleport is in processing" when I click a second time. I've waited for quite a bit, so I don't think it's doing anything.

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