--Variables local udim2 = UDim2.new local Left,Center,Right = udim2(-1,0,0,0),udim2(0,0,0,0),udim2(1,0,0,0) local easein,easeout,easesine = Enum.EasingDirection.In,Enum.EasingDirection.Out,Enum.EasingStyle.Sine local SONGS = game.StarterGui.SONGS.Frame --Loop while true do SONGS.Position = Left SONGS:TweenPosition(Center,easeout,easesine,2,true) wait(3.5) SONGS:TweenPosition(Right,easein,easesine,2,true) wait(2) end
Two things are not ideal with your script here.
local SONGS = game.StarterGui.SONGS.Frame
This accesses the StarterGui. This is NOT the same as the PlayerGui which is a different object. The PlayerGui is built from the local gui.
If this is a local script, we can make our new line be.
local player = game.Players.LocalPlayer local SONGS = player.SONGS.Frame
See this article for more information on LocalPlayer.
The second change I suggest making is that the left side of the screen is actually UDim2.new(0,0,0,0)
because 0,0 is the top left part of the screen. The horizontal center is actually UDim2.new(0.5,0,0,0)
.
Our new script is.
--Variables local udim2 = UDim2.new local Left,Center,Right = udim2(0,0,0,0),udim2(0.5,0,0,0),udim2(1,0,0,0) local easein,easeout,easesine = Enum.EasingDirection.In,Enum.EasingDirection.Out,Enum.EasingStyle.Sine local player = game.Players.LocalPlayer local SONGS = player.PlayerGui.SONGS.Frame --Loop while true do SONGS.Position = Left SONGS:TweenPosition(Center,easeout,easesine,2,true) wait(3.5) SONGS:TweenPosition(Right,easein,easesine,2,true) wait(2) end