Hello,
I'm trying to create a GUI that teleports the player who clicks it to another game.
I've set it up like this: StarterGui>ScreenGUI>ImageButton>Script
I'm certain the issue is not how the GUI is structured but I included it just to be safe. Anyways, this is my script:
function onClicked(click)
local player = game.Players:GetPlayerFromCharacter(click.Parent)
if player then
game:GetService("TeleportService"):Teleport(299324552, player)
end
end
script.Parent.MouseButton1Down:connect(onClicked)
What am I doing wrong here? I can click it just fine, but nothing happens.
This is what Output says: 18:34:45.296 - Script 'Players.Player.PlayerGui.ScreenGui.ImageButton.Script', Line 3
What's the issue here? Thank you in advanced.

1 comment
Works, thanks!