Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why isn't my script working?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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

Log in to vote
2
Answered by 9 years ago

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


Ad

Answer this question