Letter Loading Screen

Hey developers!

Sorry for the vague title, but I’m sure once I finish explaining the issue, you’ll understand pretty well what I’m talking about.

I’m trying to make it so when the player loads into the game, individual letters will appear every 0.05 second, which already works. Every letter is in a folder labeled numerically in the order they should appear. Upon testing this in studio, only one letter seems to appear.

Here’s my code:

local items = script.Parent.Parent
local tweenservice = game:GetService('TweenService')

for _,folder in pairs(items:GetChildren()) do
	if folder:IsA('Frame') then
	for i = 1, #folder:GetChildren() do
		local letter = folder[i]
		local pos = letter.Position
		letter.ImageTransparency = 1
			letter.Position = letter.Position + UDim2.new(0,0,0.16,0)
			
			task.wait(5)
		
		while task.wait(0.05) do
			tweenservice:Create(letter,TweenInfo.new(0.25,Enum.EasingStyle.Sine,Enum.EasingDirection.Out),{Position = pos, ImageTransparency = 0}):Play()
			end
		end
	end
end

the task.wait(5) isn’t very important, it’s just to have the script wait when the game loads. It will be replaced with the character added and whatnot whenever I get around to it.

Here’s what happens: Aftermath

Here’s what’s supposed to happen: Preferred Outcome

The issue is happening when it loops through the items numerically and I’m not entirely sure how to fix this. I’ve already looked through some resources and couldn’t find a solution.

Any help would be greatly appreciated!

Are there any errors? Also, could you post a screenshot from explorer of the folder tree?

Your while loop is blocking the for loop from ending to run again.
I’m not sure why you need the while loop at all as the Tween can run in a continuous loop anyway.

1 Like

There are no errors, and here’s the folder tree:
image

I can give this a shot really quick

You should try debugging it first, by printing “i” and see if it keeps printing the same number over and over. As well remove the loop, 1 tween is enough.

I’ve got it to work with a minor problem of it making an error after going past 8, but I can probably troubleshoot that by myself. Thanks for the help!

1 Like

for i = 1, #folder:GetChildren()-3 do
… would fix that minor problem

Thank you!

i hate the 30 text limit

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