Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Udim2 value not changing to right size?

Asked by 6 years ago

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})
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. xxcoordinatorxx 135 — 6y
2
remove the tables and just pass the variables. User#5423 17 — 6y
0
@xxcoordinatorxx - I shows no errors and changes all the values to 0 instead of what I want it to be FirezoneGamez 155 — 6y
0
*it FirezoneGamez 155 — 6y
View all comments (4 more)
0
Have you tried using the graphical interface tools and resize it that way? xxcoordinatorxx 135 — 6y
0
Yes it still doesn't work FirezoneGamez 155 — 6y
0
I think your overlay is ruined you might have to start over sadly xxcoordinatorxx 135 — 6y
0
As kingdom5 said, UDim2 's dont take tables, they take 4 separate args. remove the curly braces. User#17125 0 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago

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.
0
Thank you so much FirezoneGamez 155 — 6y
Ad

Answer this question