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

My bar goes up but not back down?

Asked by
Discern 1007 Moderation Voter
9 years ago

I've tried debugging this for a while, and it just not seems to be working the way it should be.

The bar (A TextLabel) goes all the way up (It's size becomes {1,0},{1,0}) but it won't come back down like it should.

There is NO output, do not ask for it. There is nothing being printed in the Output for this. Do not ask.

motion = "Up"
poweringup = true

repeat powersize = math.random(10,100)/100 until powersize ~= 1
redcolor = 1 - powersize
greencolor = powersize

while true do
    if poweringup == true then
        local powerbar = script.Parent:WaitForChild("TaskGUI"):WaitForChild("Frame"):WaitForChild("PowerFrame"):WaitForChild("PowerBar")
        if powerbar.Visible then
            powerbar.Size = UDim2.new(powersize, 0, 1, 0)
            powerbar.BackgroundColor3 = Color3.new(redcolor, greencolor, 0)
            if motion == "Up" and powersize < 1 then
                powersize = powersize + .025
                redcolor = 1 - powersize
                greencolor = powersize
            elseif motion == "Down" and powersize > 0 then
                powersize = powersize - .05
                redcolor = 1 - powersize
                greencolor = powersize
            elseif motion == "Up" and powersize == 1 then
                powersize = powersize - .05
                redcolor = 1 - powersize
                greencolor = powersize
                motion = "Down"
            elseif motion == "Down" and powersize == 0 then
                powersize = powersize + .05
                redcolor = 1 - powersize
                greencolor = powersize
                motion = "Up"
            end
        end
    end
    wait()
end

Answer this question