No error message, but my GUI frame does not work

Hello fellow devs!

Currently I am developing Samurai Era
where I want to add Spirit meter, in addition to Health meter
as shown below.

Here are the requirements:

  • Spirit recovers at certain speed like Health while it is less than 100%.
  • Certain amount of Spirit should be consumed when a player use a special ability.

I wrote a code on a local script under the GUI frame,
but it does not work without showing any error message.

Blockquote
local spiritDisplay = script.Parent
local xScale = spiritDisplay.Size.X.Scale

while xScale < 1 do

xScale += 0.1

wait(1)

end

Blockquote

What’s wrong with my code?
I will appreciate if someone help me.

local spiritDisplay = script.Parent
while spiritDisplay.Size.X.Scale < 1 do
    spiritDisplay.Size = UDim2.fromScale(spiritDisplay.Size.X.Scale+.1, 1)
    wait(1)
end

your xScale var is just a clone

local x = workspace.Gravity
x = -1
print(workspace.Gravity, " :: ", x)
--Output: "196  ::  -1"

GuiObject.Size (roblox.com)

2 Likes

It seems to work good now.
Thank you so much!

1 Like

Please mark his reply as the solution, if it helped.