I have a local script located in my gui text button and if the user clicks the button, they teleport to another place. But for some reason on the output it says: "Unable to cast value to object". and also it doesn't teleport me.

local TeleportService = game:GetService("TeleportService")

local lobby = 1357679361

script.Parent.Parent.Play.MouseButton1Down:connect(function(player)
	TeleportService:Teleport(lobby, player)
end)

i really need help on this. Means a lot to me for a solution. Thanks.

1 comment

0

I don't think this stuff works in localscripts