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

Udim2 value not changing to right size?

It doesn't change the size of the gui as expected

local HealthOverlay = script.Parent.Health:WaitForChild("Overlay")

local xscale = 0
local xOffset = 250

local yscale = 0
local yOffset = 23 

HealthOverlay.Size = UDim2.new({xscale,xOffset},{yscale,yOffset})

8 comments

0

Is it meant to be around curly braces like that and did you get anything from the output with red or orange lines and have you tried doing HealthOverlay.Size.x = ... etc.

2

remove the tables and just pass the variables.

0

@xxcoordinatorxx - I shows no errors and changes all the values to 0 instead of what I want it to be

0

*it

0

Have you tried using the graphical interface tools and resize it that way?

0

Yes it still doesn't work

0

I think your overlay is ruined you might have to start over sadly

0

As kingdom5 said, UDim2 's dont take tables, they take 4 separate args. remove the curly braces.

1 answer

✓ Accepted answer

You're trying to call the UDim2.new function with two table arguments when it expects four number arguments. Remove the curled brackets and the script will run without error.

local HealthOverlay = script.Parent.Health:WaitForChild("Overlay")

local xscale = 0
local xOffset = 250

local yscale = 0
local yOffset = 23 

HealthOverlay.Size = UDim2.new(xscale,xOffset, yscale,yOffset) -- this function does NOT use two tables as arguments, it instead uses four numbers.

1 comment

0

Thank you so much

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