Loading Screen Wait() not working

I got a loading GUI that appears before the players get in the game and to keep the player excited I had a “fact” board list out different things as the game loads. I was testing the loading screen in-game and noticed that when checking the dev console the print “1” only fires once at the beginning and does not fire after it. Seeing that the only thing stopping this event would be the wait, but it puzzles me since it should work. Please help me out with this one I am stumped.

(This is a GUI that replace the default loading screen btw)

while true do
	print('1')
	repeat
		script.Parent.TextTransparency = script.Parent.TextTransparency+.1
		wait(.1)
	until script.Parent.TextTransparency >= 1
	script.Parent.Text = facts[math.random(1,9)]
	repeat
		script.Parent.TextTransparency = script.Parent.TextTransparency-.1
		wait(.1)
	until script.Parent.TextTransparency <= 0
	if script.Parent.Text == facts[6] then
		script.Fart:Play()
	end
	script.Elevation.Playing = true
	workspace.Spooky:Stop()
	wait(5)
end

TextTransparency does exist inside of text labels and other types of UI elements. image

I am not the OP I was just telling you that TextTransparency exists lol.

Use a for loop.

for i = 0, 1, 0.1 do
   wait(0.1)
   script.Parent.TextTransparency = i
end

script.Parent.Text = facts[math.random(1,9)]

for i = 1, 0, -0.1 do
   wait(0.1)
   script.Parent.TextTransparency = i
end

if script.Parent.Text == facts[6] then
		script.Fart:Play()
end

script.Elevation.Playing = true
workspace.Spooky:Stop()

functions wouldn’t matter in this situation since they all work, remember that there are no errors and it only stops when it gets to wait(5)

I’m starting to feel like it might be the workspace thing (when it’s loading the workspace audio wouldn’t be there for it to stop erroring the script). I’ll try adding a :FindFirstChild() for it.

Yup it was error issue, felt very silly about this. Note in the future; check if a part exists before touching it.

1 Like