Is this the proper way of writing this script in a local script? The code is changing the text and color of the text based on the health percentage.
local plr = game.Players.LocalPlayer
while true do
script.Parent.Text = math.floor(plr.Character.Humanoid.Health) .. "%"
wait(.1)
if plr.Character.Humanoid.Health <=100 then
script.Parent.TextColor3 = Color3.new(0/255,255/255,0/255)
if plr.Character.Humanoid.Health <=75 then
script.Parent.TextColor3 = Color3.new(235/255,169/255,1/255)
if plr.Character.Humanoid.Health <=50 then
script.Parent.TextColor3 = Color3.new(227/255,122/255,2/255)
if plr.Character.Humanoid.Health <=30 then
script.Parent.TextColor3 = Color3.new(232/255,89/255,22/255)
if plr.Character.Humanoid.Health <=10 then
script.Parent.TextColor3 = Color3.new(255/255,0/255,0/255)
end
end
end
end
end
end
