I need a button that teleports player when clicked but the output says "attempt to index nil with parent" pls help
local tp = script.Parent
tp.MouseButton1Click:Connect(function(go)
local TeleportService = game:GetService("TeleportService")
local lobby = 4920256514
local player = game.Players:GetPlayerFromCharacter(go.Parent)
if player then
TeleportService:Teleport(lobby, player)
end
end)

4 comments
Are you using a part or a GUI?
no i have the button but it wont teleport player ot the lobby
I know but are you clicking a GUI button or a Part?
if you are using a gui, by saying "go.Parent" you would be trying to get the Players folder. Change it to just "go"