Help with loading animation

Hi!

I tried doing a new loading animation to look cool, but it’s completely broken.

local function SkeletonLoadingAnimation(Frame)
	for i, v in ipairs(Frame) do
		if v:IsA("Frame") then
			local Items = v:GetDescendants()
			for i, v in ipairs(Items) do
				if v:IsA("TextLabel") or v:IsA("ImageLabel") or v:IsA("TextBox") or v:IsA("TextButton") and not v.Name == "Template" and not v.Name == "Background" then
					print(v.Name)
					if not v.Name == "Background" then
						local anim = game:GetService("TweenService"):Create(v, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true, 0), {BackgroundTransparency=0})
						anim:Play()
					end
				end
			end
		end
	end
end

That code prints out the name of 2 TextLabels, and doesn’t tween them at all.

I did have it working, but it was tweening the frame and the background.
It’s probably something witgh the if statement logic, but I cant figure it out.

Thanks for any help!

                    if not v.Name == "Background" then
                        print(true)
						local anim = game:GetService("TweenService"):Create(v, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true, 0), {BackgroundTransparency=0})
						anim:Play()
					end

Tell me if it prints true. Also, you want your background to be fully visible, correct?

No, I dont want the background to be visible.

And no, it’s not printing true. I removed that if statement, and now I’m getting the TextLabels tweening, but not anything else.

I also dont see “Time” tweening, only “Name”

Then why are you setting the BackgroundTransparency to 0?

I thought you meant the container frame, that’s exactly what I’m trying to do

Mind showing your full script? For conext purposes. :no_mouth:

This is in a testing place, so here’s the full testing script

local function SkeletonLoadingAnimation(Frame)
	for i, v in ipairs(Frame) do
		if v:IsA("Frame") then
			local Items = v:GetDescendants()
			for i, v in ipairs(Items) do
				if v:IsA("TextLabel") or v:IsA("ImageLabel") and not v.Name == "Template" and not v.Name == "Background" then
					print(v.Name)
						print(true)
						local anim = game:GetService("TweenService"):Create(v, TweenInfo.new(1, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut, 0, true, 0), {BackgroundTransparency=0})
						anim:Play()
				end
			end
		end
	end
end


while true do
	task.wait(2)
	SkeletonLoadingAnimation(script.Parent.SkeletonLoading:GetChildren())
end

Is “Time” and “Name” being printed? Also, what are their BackgroundTransparencies at.

1 Like

That’s my issue, it’s 1 by default :facepalm:

Thanks for the help

I didn’t understand, but great to have helped. :+1:

All of the assets’ background were visible by default, so I was pretty much tweening them to 1 then reversing it