Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why isn't my script working?

I know I did everything right, but it isn't working.

while wait() do
	if game.Workspace.Loading.Value == true then
		script.Parent.DarkScreen.Visible = true
		repeat script.Parent.DarkScreen.BackgroundTransparency = script.Parent.DarkScreen.BackgroundTransparency -0.1
		until script.Parent.DarkScreen.BackgroundTransparency <=0
		script.Parent.GameLoad.Visible = true
		script.Parent.DarkScreen.Visible = false
		wait(12)
		script.Parent.GameLoad.Visible = false
	end
end

1 answer

✓ Accepted answer

It's simple. Your repeat is the problem. You need to add a wait to it.

Time = 3 --3 seconds.

while wait() do
    if game.Workspace.Loading.Value == true then
        script.Parent.DarkScreen.Visible = true
        repeat script.Parent.DarkScreen.BackgroundTransparency = script.Parent.DarkScreen.BackgroundTransparency -0.1
wait(Time)
        until script.Parent.DarkScreen.BackgroundTransparency <=0
        script.Parent.GameLoad.Visible = true
        script.Parent.DarkScreen.Visible = false
        wait(12)
        script.Parent.GameLoad.Visible = false
    end
end



Alternatively, you can use for loops.

Time = 3 --3 seconds.

while wait() do
    if game.Workspace.Loading.Value == true then
        script.Parent.DarkScreen.Visible = true
        for transparency = 1,0,-0.1 script.Parent.DarkScreen.BackgroundTransparency = transparency
	wait(Time)
        end
        script.Parent.GameLoad.Visible = true
        script.Parent.DarkScreen.Visible = false
        wait(12)
        script.Parent.GameLoad.Visible = false
    end
end


This discussion is preserved as it was. New answers, comments, and votes are closed.