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

Help with formatting UDim2 values?

Asked by 5 years ago
Edited 5 years ago
local stam = 100
local mstam = 100

_G.drain = function(amount)
    if stam - amount >= 0 and stam - amount <= mstam then
        stam = stam - amount
        s.Text = stam.."/"..mstam
        hum.WalkSpeed = 16 * 2
        bar:TweenSize(UDim2.new(stam / mstam, 0, .6, 0),'Out', 'Linear', 0.5, true)
    elseif stam - amount <= 0 and stam - amount <= mstam then
        stam = 0
        s.Text = stam.."/"..mstam
        hum.WalkSpeed = 10
        bar:TweenSize(UDim2.new(stam / mstam, 0, .6, 0), 'Out', 'Linear', 0.5, true)
        spawn(function()
            wait(5)
            hum.WalkSpeed = 16
        end)
    end
end

_G.regen = function(amount)
    if stam + amount >= 0 and stam + amount <= mstam then
        wait(0.1)
        stam = stam + amount
        s.Text = stam.."/"..mstam
        bar:TweenSize(UDim2.new(stam / mstam, 0, .6, 0),'Out', 'Linear', 0.5, true)
        hum.WalkSpeed = 16
    elseif stam + amount >= 0 and stam + amount < mstam then
        stam = mstam
        s.Text = stam.."/"..mstam
        bar:TweenSize(UDim2.new(stam / mstam, 0, .6, 0),'Out', 'Linear', 0.5, true)
        hum.WalkSpeed = 16
    end
end

I'm mostly interested in the UDim2 values, as when I use it it goes over the background bar as well as weird tweens from the vertical part. Can anyone help with formatting the Frame to stop this? (links:) here

0
If your bar is offseted from the left side? YTRaulByte 389 — 5y
0
eww _G User#19524 175 — 5y
0
don't see any problems with _G.... mrspirit9 68 — 5y
0
Are there any GIFs or Images you can show, not really sure what you mean. climethestair 1663 — 5y

Answer this question