I made this GUI and when your gun fires I wanna have the frame go down like -5 studs each shot or depending on how much ammo you have, and when your at 0 the bar refills back to the top.
I don’t know how to do this but I already figured out how to make the bar go back up and just need help with it going down by certain amount per shot
function Fire()
--do your gunfired code, make variables for currentammo and totalammo (the ammo in the clip and the clip size)
currentammo -= 1
ammogui:TweenSize(UDim2.fromScale(1, 1 * (currentammo / totalammo), "Out", "Quint", 2, true)
end
You need to get a value between 0 and 1. This will serve as the percentage of bullets you have left that way you can scale the bar accordingly.
--# Get a value between 0 and 1 that serves as the percent of amount of bullets left
local percentOfBulletsLeft = currentAmountOfBullets / totalAmountOfBullets
--# Now scale the frame by that number
Bar.Size = Udim2.new(1,0,percentOfBulletsLeft,0)