Every time i click the button, the gui just instantly moves. This is the code
local button = script.Parent.Parent.Button.Button local shop = script.Parent.Parent.Shop local guiopen = false button.MouseButton1Click:Connect(function() if not guiopen then guiopen = true shop:TweenPosition(UDim2.new(0.318,0,0.219,0),Enum.EasingDirection.In,Enum.EasingStyle.Quad,3,false,nil) elseif guiopen then guiopen = false shop:TweenPosition(UDim2.new(0.318,0,100,0),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,3,false,nil) end end)
Because you have not given the tween enough information to do so.
Tween consists of multiple parameters in which help move and animate your UI.
The Parameters consisting of (in order):
1. Position (UDim2)
2. EasingDirection (Starting direction, not really needed unless animating the tween)
3. EasingStyle (Animation style)
4. Time (how long it takes to reach desired position)
5. Override (true/false, allows you to override an ongoing tween)
If your case, it should look a little like this:
shop:TweenPosition(UDim2.new(0,0,0,0), Enum.EasingDirection.In, Enum.EasingStyle.Linear, 1, true)