Heres my code, it should be pretty easy to understand what I'm trying to get done. The code works just I don't know why my player is being turned completely white and not somewhat in the range of green. My problem definitely with the math.Randoms
local zombieZombieTone = Instance.new("BodyColors") zombieZombieTone.Name = ("Zombie Colors") zombieZombieTone.Parent = hit.Parent local zombieToneParts = {"HeadColor", "LeftArmColor", "LeftLegColor", "RightArmColor", "RightLegColor", "TorsoColor"} for y, u in pairs(zombieToneParts) do hit.Parent["Zombie Colors"][u] = BrickColor.new(math.random(0, 130), math.random(158, 164), math.random(0, 130)) end
This is a common case of misunderstanding BrickColor.new
. BrickColor.new
(as well as Color3.new
) actually doesn't take arguments in ranges of 0 to 255. BrickColor.new
expects a number between 0 and 1. Going over or under can cause unpredictable results.
If you want to use a range of 0 to 255, then your best option would be to use replace the argument in the BrickColor.new
with a Color3
using a Color3.fromRGB
, NOT Color3.new
.