Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why doesn't a part's brick color change according to a humanoid's health?

Asked by 6 years ago

Hi helpers, I'm trying to make a script so that, a part's brick color is dependent on a humanoid's health, eg if the humanoid's health is 100, the part's brick color is green, but if the health is 0, the brick color is red. The "Target" is a model with a torso, humanoid root part, a humanoid, a head, and other body parts. The script is located inside the humanoid root part. Here is the code.


local Target = script.Parent.Parent

local Torso = Target.Torso

local Hmd = Target.Humanoid.Health

while true do Torso.BrickColor = BrickColor.new(1 - (Hmd * 0.01), Hmd * 0.01, 0) wait(0.1) end


A response would be helpful. Thanks! -cooldeath49

0
BrickColor.new("Bright Red") asks for a string value, I think the value you want to change is Color located just below BrickColor. Torso.Color = Color3.fromRGB(1 - (Hmd * 0.01), Hmd * 0.01, 0) something like that here is the wiki so you can learn more: http://wiki.roblox.com/index.php?title=API:Color3 TheGreatSailor 20 — 6y
0
Ok, thanks! cooldeath49 37 — 6y

Answer this question