Tweening Problems

The first tween plays. But then the second tween doesn’t. Please help me.

SCRIPT -

local events = game:GetService("ReplicatedStorage"):WaitForChild("PlayerEvents")
local event = events:WaitForChild("LoadingEvent")
local frame = script.Parent.Frame

event.OnClientEvent:Connect(function()
	frame:TweenPosition(UDim2.new({0, 0},{0, 0}), Enum.EasingDirection.In, Enum.EasingStyle.Quad, 1, false)
	wait(3)
	frame:TweenPosition(UDim2.new({0, 0},{-1, 0}), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 1, false)
end)
1 Like

Try using a different easing style for the second tween.

1 Like

Still didn’t work (filer filler filler)

1 Like

I’ve never seen tweens done like that before. You might’ve already looked at this, but if not here’s the documentation on tweens: Tween | Roblox Creator Documentation


I can’t tell what’s going on here, as I haven’t done it like that, but I’d imagine you still can use the reverse and time stuff, however you spell it, parameters. Something.

1 Like

Frame:TweenPosition() only Accepts strings instead of Enums for EasingStyle and EasingDirection

As an Extra Note: you should use UDim2.fromScale if you are only using the scale:

frame:TweenPosition(UDim2.fromScale(0, 0), "In", "Quad", 1, false)
-- This should be the "Correct way"
frame:TweenPosition(UDim2.fromScale(0, -1), "In", "Quad", 1, false)

However it is recommended that you use TweenService Instead of TweenPosition(), TweenSize() and TweenSizeAndPosition()

1 Like

I know why. Its because in the code you have done frame:TweenPosition(UDim2.new({0, 0},{0, 0}). Notice the little curly brackets { and }. This was the first tween I learned lol so that should fix it.

Also, use strings in the EasingDirection and EasingStyle, so all in all your code should look something like this:

local events = game:GetService("ReplicatedStorage"):WaitForChild("PlayerEvents")
local event = events:WaitForChild("LoadingEvent")
local frame = script.Parent.Frame

event.OnClientEvent:Connect(function()
	frame:TweenPosition(UDim2.new(0, 0, 0, 0), "In", "Quad", 1, false)
	wait(3)
	frame:TweenPosition(UDim2.new(0, 0, -1, 0), "In" , "Quad", 1, false)
end)

If that doesn’t work, try swapping around the "In" and "Quad".

3 Likes

Thanks! This was the solution. I forgot to remove the {} brackets. Also I didn’t know that instead of doing Enum.EasingStyle.Quad. You can just do “Quad”. That will come in handy for future scripts. Thanks for helping me out guys.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.