Please tell me what is changing the size of my gui.
Script:
wait(0.2)
while true do
local hp = game.Players.LocalPlayer.Character.Humanoid.Health/100
script.Parent:TweenSize((UDim2.new(hp,0,1,0)),Enum.EasingDirection.Out,Enum.EasingStyle.Quad,0.15)
wait(0.2)
end
Your problem is most likely it’s not set to scale. You can do it manually but using a plugin is much easier. Scale plugin using this plugin you need to set the scale position and the scale size and thag should fix your issues.
Alright. Is that not what you wanted? The script is causing it to change, if you don’t want it to change just keep the script disabled or remove it. What are you trying to accomplish?
The script moves the bar like it’s supposed to and that’s what I want. To show how much health is left. The script if also changing the size of the gui so now I’m thinking of writing a different script to do the same thing.
No clue why you’re doing a while true do loop, I think it can be fixed though if there’s no offset?
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local YSize = script.Parent.Size.Y.Scale --I'm guessing is where it could be? This is just to prevent the Y UI from changing size
Character.Humanoid.HealthChanged:Connect(function()
local Scale = Character.Humanoid.Health / 100
script.Parent:TweenSize((UDim2.new(Scale, 0, YSize, 0)), Enum.EasingDirection.Out, Enum.EasingStyle.Quad, 0.15)
end)
There seems like one issue with your solution, you forgot .Scale because Size.Y has two properties .Scale and .Offset UDim2 | Documentation - Roblox Creator Hub as displayed in the docs on UDim2.