Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

UDim2 Resize Help?

16:23:33.954 - Players.Player.Backpack.Mainframe:132: attempt to perform arithmetic on a userdata value fgui.GUI.Size = UDim2.new(0.3, 0, 0.02, 0) * (Fuel/MaxFuel)

1 comment

0

Could you post the script in question?

1 answer

So you are making a bar that changes size depending on the amount of fuel?

Here is a better way of doing what you were doing:

Hierarchy

  • ScreenGui
    • BarHolder (size of the bar)
      • Bar (what you resize)
    • Script

LocalScript

local maxFuel = 100
local fuel = maxFuel

while wait() do
	script.Parent.BarHolder.Bar:TweenSize(UDim2.new((1/maxFuel) * fuel,0,1,0),"InOut","Quad",0.1,false) -- this is for a bar on the X axis, not the Y, to have it on Y, simply change the first argument to 1
end

This is for a length wise bar , not height wise. To change, simply swap the first argument of UDim2.new() with the third.

Tweens change the size/position of a gui smoothly.

This discussion is preserved as it was. New answers, comments, and votes are closed.