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

5 comments

0

If your bar is offseted from the left side?

0

eww _G

0

don't see any problems with _G....

0

Are there any GIFs or Images you can show, not really sure what you mean.