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

Countdown Gui with decimals, adding random 0s or 9s to the end. Whats wrong with it?

Asked by 3 years ago

Hello, I have been making a count down with decimals but I run it seems to add 0s or 9s to the end. Depending if I use IntValue or NumberValue. Here is my code:

script.Parent.MID.Text = m..":"..s
while true do
    if s <= 0.00 then
            if m == 0 then
                break;
            else
                m=m -1
                s = 58.99
            end
        else
        s = s-.01
        end 
    if s <= 9.99 then
        script.Parent.MID.Text= m..":0"..s
    else
        script.Parent.MID.Text= m..":"..s
    end
    wait(.01)
end

Thanks.

1 answer

Log in to vote
0
Answered by 3 years ago

Solved. New script if you need it.

runservice.Stepped:Connect(function()
if not done then    
        if ms == 0 then
            if s == 0 then

                if m == 0 then
            script.Parent.MID.Text = "00:00.00"
        else
            m=m -1
                    s = 58
                    ms = 99
                end

            else
                s = s-1
                ms = 99
        end

    else
        ms = ms-3
    end 
        script.Parent.MID.Text= m..":"..s.."."..ms

        if s < 10 then
            script.Parent.MID.Text= m..":0"..s.."."..ms
        else
            script.Parent.MID.Text= m..":"..s.."."..ms
        end
    wait(0.03)
    else
        script.Parent.MID.Text = "00:00.00"
        script.Disabled = true
    end
end
Ad

Answer this question