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

why does it add random numbers?

Asked by 4 years ago

so im trying to make a progress bar but i ran into one issue

UIS.InputBegan:Connect(function()
    if vGame.Value then
        if bar.Size.X.Scale <= 1 then
            bar.Size = UDim2.new(bar.Size.X.Scale + 1/value,0,1,0)
            value = value - 1
            print(value)
        else
            vGame.Value = false
            bar.BackgroundColor3 = Color3.fromRGB(60, 182, 0)
            wait(5)
            script.Parent.Visible = false
        end
    end
end)

i think the problem comes from this line

bar.Size = UDim2.new(bar.Size.X.Scale + 1/value,0,1,0)

value is 200 which means 1/200 = 0.005

but roblox for some reason when i click, adds 0.004 or 0.006

0
You might have to use some Math to solve, but you might need to convert the 0.004 or 0.006 into the TextLabel as the number you want. For example, 0.006 could be 60 XP. 0.004 could be 40 XP. I can try to create a small Demo. onforgot 11 — 4y

Answer this question