Its a localScript in a frame, in another frame, and there is a text label that says the percentage, it worked very good before, but now it isn't working, i dont know why because i can't see any errors, what was broken this time? -.-
local P = game:GetService("Players").LocalPlayer local C = P.CharacterAdded:wait(1) local H = C:WaitForChild("Humanoid") H.HealthChanged:connect(function() script.Parent:TweenSize(UDim2.new(1/(H.MaxHealth/math.floor(H.Health + .5)),0,1,0), Enum.EasingDirection.Out, Enum.EasingStyle.Bounce,1) script.Parent.Parent.percentage.Text = tostring(math.floor(100/(H.MaxHealth/H.Health)).."%") end)
thanks for help this new scripter -.-
You don't divide 1 / XYZ or 100 / XYZ. You just divide the MaxHealth by the Health.
This will return a value within the range of 1 to 0, which is a perfect fit for the Scale property of a UDim2 value. You can plug this into a UDim2 by doing this:
lua
GuiObject.Size = UDim2.new(Humanoid.MaxHealth/Humanoid.Health, 0, 1, 0)
Also, Math.floor() cannot be used to round decimals. It only floors to the nearest whole number, which for a decimal sub-one, is zero.