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

Why wont my button image teleporting script work?

Hi. I am making a roblox game like Myst 3 Exile. So I am making books which when you click an imagebutton it teleports you to another place. But my scripts for the teleporting arent working at all.

This is my teleporter script.

local TeleportService = game:GetService("TeleportService")
 
local level1Id = 2573376319
--local level2Id = 
 
game.Players.PlayerAdded:connect(function(player)
	TeleportService:Teleport(level1Id, player)
end)

This is the path for the image thing https://imgur.com/a/vNlwir2

So how do I fix it so when you click the image in the surface gui on the block it teleports you to the place. I cant find it anywhere.

5 comments

0

Do I need a click detector ?

0

Do you really need Teleport Service? Simply use CFrame.

0

^ face palm

0

i dont think you use CFrames to teleport players through places and games

0

LOL...... Sad invencive.... ^^^.. I am laughing so hard rn... Anyways, back to the question, Change connect to Connect and if you don't have the game connected with level1Id then connect that place to the game

1 answer

✓ Accepted answer

You should put an ImageButton on your surfacegui and then use the MouseButton1Click event, if I'm not mistaken. Or, if you use ClickDetectors, it will be for the entire part it's in, not just an image, so put the image in a separate part with the ClickDetector, if you're using that. Your code sends a player in another place when they enter. Not useful?

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