Can someone tell me how I would make this Health Bar script remove the 264808654785
in 49.264808654785
so it just show's the 49
?
Code:
local player = game:GetService("Players").LocalPlayer -- Probably doesn't need GetService, oh well. local char = player.Character local text = script.Parent:FindFirstChild("Text") local frame = script.Parent:FindFirstChild("ColorFrame") char.Humanoid.HealthChanged:connect(function() frame:TweenSize(UDim2.new(0,2*char.Humanoid.Health,1,0),"Out","Quad",0.000001) text.Text = "Health: "..char.Humanoid.Health.." / "..char.Humanoid.MaxHealth end)
Simple!
We use math.floor / math.ceil
So say you want to round up, We'd use math.ceil. (ceil is short for ceiling which mean roof), Vice versa for math.floor.
local player = game:GetService("Players").LocalPlayer -- Probably doesn't need GetService, oh well. local char = player.Character local text = script.Parent:FindFirstChild("Text") local frame = script.Parent:FindFirstChild("ColorFrame") char.Humanoid.HealthChanged:connect(function() frame:TweenSize(UDim2.new(0,2*char.Humanoid.Health,1,0),"Out","Quad",0.000001) text.Text = "Health: "..math.floor(char.Humanoid.Health).." / "..char.Humanoid.MaxHealth end)