UDIM2 making bar slightly too big

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I made a bar and I want the max bar size to be the same as it is

  2. What is the issue? Include screenshots / videos if possible!
    the bar gets big in the start of the game (first image = normal, second = ingame)
    image
    image
    btw the bar doesn’t go right, it goes left after it gets big

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i looked in the developer hub but found no answers

the code

local hungermax = workspace.part.stats.Hunger.Value --100
local hunger = workspace.part.stats.Hunger

hunger.Changed:Connect(function(e)
	script.Parent:TweenSize(UDim2.new(e / hungermax, 0, .78, 0), "Out", "Linear", .1)
end)

I believe the issue is that your max size of the green bar shouldn’t be 1, as that would be the same size as the parent. You want it to be somewhat smaller, say 0.9 wide or something along those lines.

If you replace e / hungermax with (e / hungermax) * MAX_SIZE where MAX_SIZE is the size of it full, then you should get your desired result. If you have any questions just let me know!

1 Like