Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

3 comments

0

whoops

0

wait no

0

look at the full code

This discussion is preserved as it was. New answers, comments, and votes are closed.