I hope my scripting makes sense. Attempting to decrease the width of a text label (which is why i multiplied it by percentage). Quite new to this, so any advice would help a lot. Green is the label, and was defined before this section of code. thanks in advance
''''lua
local function onHealthChanged()
local percentage = Health.Value / MaxHealth
local currentSize = Green.Size
Green.Size = UDim2.new((currentSize.X.Scale * percentage), currentSize.X.Offset, currentSize.Y.Scale, currentSize.Y.Offset)
end
''''
Health.Changed:Connect(onHealthChanged)
#Trying to Multiply xScale by Health Percentage for label of HealthUI. No errors, but nothing changes
1 messages · Page 1 of 1 (latest)
resize according to starting size, not current size.
so would it then just be sizeX.scale?
resize according to starting size, not current size.
im a bit confused
which part
to resize. like do i use size.X.scale instead of currentSize or is there another function that can be used
set size according to starting size, not current size
local startingsize=f.size f.size=startingsize*percent?
instead of f.size=f.size*percent?
?
❓
wdym
local startingSize = Green.Size
Green.Size = UDim2.new((startingsize.X.Scale * percentage), startingsize.X.Offset, startingsize.Y.Scale, currentSize.Y.Offset)
** You are now Level 1! **
is this what you mean? im still confused also tysm for ur help so far
this says Green.Size = Green.Size * percentage
;compile lua ```lua
local percentage=0.67
local GreenSize=67
for i=1,15 do
GreenSize=GreenSizepercentage
end
print("nay ",GreenSize," ~= ",67percentage)
GreenSize=67
StartSize=67
for i=1,15 do
GreenSize=StartSizepercentage
end
print("yay ",GreenSize," == ",67percentage)```
Program Output
nay 0.16489095875624 ~= 44.89
yay 44.89 == 44.89
.pyrofire | lua | lua-5.4.7 | wandbox.org
ohhh so make a new variable and dont set them equal
this makes so much more sense thank u
okay ive been trying to implement this into my code but its still not working omfg
local currentsize = UDim2.new((StartingSize.X.Scale * percentage), StartingSize.X.Offset, StartingSize.Y.Scale, StartingSize.Y.Offset)
end
i tried to use green.size but it just gives "unexpected identifier"