At the moment I am doing this function to change the BodyColor of my player using an RGB value which is passed in a table. Is there a better way to do this without creating your own table and going through it?

Table Example:

{Reason = "ApplyBodyColor", BodyColor = Color3.fromRGB(255, 0, 0)}

Function Code:

function Edit.ApplyBodyColor(Player, BodyColor) -- Uses Color3.fromRGB()
	if (Player.Character ~= nil) then
		local Limbs = { -- BodyColor3 values
			"HeadColor3",
			"LeftArmColor3",
			"LeftLegColor3",
			"RightArmColor3",
			"RightLegColor3",
			"TorsoColor3"
		}
		for _, limb in ipairs(Limbs) do
			Player.Character["Body Colors"][limb] = BodyColor
		end
	end
end

4 comments

0

you could loop for all parts in characters that name isnt HumanoidRootPart?

0

why are u using ipairs even

0

Make a module for it

0

And loop through the parts