This is a basic script that seems to work in studio mode, but not online.
1 | local player = game.Players.LocalPlayer |
2 |
3 | player.leaderstats.Points.Changed:connect( function () |
4 | script.Parent.Parent:TweenPosition(UDim 2. new( 0.4 , 0 , 0.2 , 0 ), "Out" , "In" , 1.5 , true ) |
5 | wait( 5 ) |
6 | script.Parent.Parent:TweenPosition(UDim 2. new( 0.4 , 0 , 1 , 0 ), "Out" , "Back" , 1.5 , true ) |
7 | end ) |
You can only access the LocalPlayer
property from a LocalScript.
For Script objects, it will always be nil
.
This is because it is not clear which player is "local" when a non-LocalScript is being run -- it's run by the server.
Use a LocalScript instead of a Script; or don't use the LocalPlayer as the way to reference the GUI objects (e.g., script.Parent.Parent.Label
or the equivalent for your path)