I'm kinda new to tweening. For some reason, my script has no errors. But just doesn't work.
Script:
plr = game.Players.LocalPlayer game.Players.PlayerAdded:connect(function() if script.Parent.Position == UDim2.new(-1, 0, 0, 0) then script.Parent:TweenPosition(UDim2.new(0, 0, 0, 0)) end end)
Credit to DataStore for pointing out my initial error whilst writing this answer
The PlayerAdded
event doesn't work in localscripts! You need to change your code so that this tweens the gui from the server - and index the gui from the player's PlayerGui.
game.Players.PlayerAdded:connect(function(plr) plr:WaitForChild('PlayerGui') --Wait for the player's playergui to load local gui = plr.PlayerGui.ScreenGui --INDEX THE GUI HERE PLEASE --The conditional is kind of redundant. Since the player only joins once script.Parent:TweenPosition(UDim2.new(0,0,0,0)) end)