Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[SOLVED] Why does my gui have no tweening animation?

Asked by 4 years ago
Edited 4 years ago

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)

1 answer

Log in to vote
0
Answered by
pwx 1581 Moderation Voter
4 years ago
Edited 4 years ago

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)

You can read up on tweening here and here.

0
whoops HomieFirePGN 137 — 4y
0
wait no HomieFirePGN 137 — 4y
0
look at the full code HomieFirePGN 137 — 4y
Ad

Answer this question