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

Why wont my button image teleporting script work?

Asked by 5 years ago

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.

0
Do I need a click detector ? HeadlessGuide 16 — 5y
0
Do you really need Teleport Service? Simply use CFrame. Invencivel1 -5 — 5y
0
^ *face palm* User#23365 30 — 5y
0
i dont think you use CFrames to teleport players through places and games User#23365 30 — 5y
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 greatneil80 2647 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

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?

Ad

Answer this question