plr = game.Players.LocalPlayer
while true do
script.Parent.Size.X.Offset = plr.Character.Humanoid.Health * 4 --the parent of this script is the gui
wait(.1)
end
✓ ANSWER ACCEPTED
How to change a GUI's size from script? (Offset cannot be assigned to)
1 answer
✓ Accepted answer
Here is the correct code:
plr = game.Players.LocalPlayer
while true do script.Parent.Size = UDim2.new(0,plr.Character.Humanoid.Health * 4,1,0) wait(.1) end
The second place in the UDim2.new is for offset, while the first is for scale. Hope this helped...
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
You'll need to set all of the guis size.
To add onto ^, the 'X' property is read-only, meaning you cannot set it to a new value. You need to set the whole thing (i.e. script.pt.Size = UDim2.new(0,0,0,0) )
Thank you guys!
script.Parent.Size = Udim2.new(plr.Character.Humanoid.Health * 4, 0, 1, 0) -- This should work