I built a teleport script but I get an error saying player not found when playing In game. This works in the workspace however.
1 | player = game.Players.LocalPlayer |
2 | script.Parent.MouseButton 1 Down:connect( function () |
3 | game:GetService( "TeleportService" ):Teleport( 334747890 , player) |
4 | end ) |
I get 0 player console errors.
Assuming this is in a GUI, you simply need to change this Script into a LocalScript for it to work, as LocalScripts will run inside a Player's PlayerGui.
1 | player = script.Parent.Parent.Parent.Parent.Parent |
2 | script.Parent.MouseButton 1 Down:connect( function () |
3 |
4 | game:GetService( "TeleportService" ):Teleport( 334747890 , player) |
5 | end ) |
Let me know if this worked? Ty.