TweenService not working

I am trying to make my game intro and everything is fine, no errors, but there is one thing that wont work, the Tweenservice.

local function StartAnimation()
	
	local LoadingUI = script.Parent:WaitForChild("Storage"):WaitForChild("Loading"):Clone()
	LoadingUI.Parent = game.Players.LocalPlayer.PlayerGui
	LoadingUI.Enabled = true
	
	wait(2)
	
	LoadingUI.Bg.Holder.Btn.Main:TweenSize(UDim2.new(LoadingUI.Bg.Holder.Btn.Needed.Size),'In','Quad',2);
	
	task.wait()
	
	for i = 0, 50, 1 do
		for _, dec in pairs(LoadingUI:GetDescendants()) do
			if typeof(dec) == 'Instance' and dec:IsA("GuiObject") then
				dec.Transparency += 0.05
			end
		end
	end
	
	LoadingUI.Enabled = false
	LoadingUI:Destroy()
	
	script.Parent.Parent.Parent.Client.Values.Main.HasLoaded.Value = true
end

StartAnimation()

Basically, I will join and the TweenService does not even start. Not even the fading will work at the end. It just cuts short. I added a task.wait() and wait(2) too see if it would work, nothing changed.

robloxapp-20230731-1425058.wmv (513.2 KB)

I would appreciate if you could help!

2 Likes

Use Enum.EasingStyle and Enum.EasingDirection instead of “In” and “Quad”

I always do ‘In’, and ‘Quad’, but I tried this anyways and I have the same problem.

I found the issue write :

local function StartAnimation()

	local LoadingUI = script.Parent:WaitForChild("Storage"):WaitForChild("Loading"):Clone()
	LoadingUI.Parent = game.Players.LocalPlayer.PlayerGui
	LoadingUI.Enabled = true

	wait(2)

	LoadingUI.Bg.Holder.Btn.Main:TweenSize(LoadingUI.Bg.Holder.Btn.Needed.Size,'In','Quad',2);

	task.wait()

	for i = 0, 50, 1 do
		for _, dec in pairs(LoadingUI:GetDescendants()) do
			if typeof(dec) == 'Instance' and dec:IsA("GuiObject") then
				dec.Transparency += 0.05
			end
		end
	end

	LoadingUI.Enabled = false
	LoadingUI:Destroy()
	
	script.Parent.Parent.Parent.Client.Values.Main.HasLoaded.Value = true
end

StartAnimation()

you wrote : Udim2.new(LoadingUI.Bg.Holder.Btn.Needed.Size)

Oh I see. One second. Character limittttttttttttttttttttttttttttt

Yours did not change anything, It was actually because I did not add wait in the for i loop. lol

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