Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Works for the meshparts and parts, but for unions it just fails. Anybody?

local ColorTable = {
	Color3.fromRGB(196, 40, 28),--Red
	Color3.fromRGB(0, 16, 176),--Dark Blue
	Color3.fromRGB(40, 127, 71),--Dark Green
	Color3.fromRGB(255, 102, 204),--Pink
	Color3.fromRGB(218, 133, 65),--Orange
	Color3.fromRGB(245, 205, 48),--Yellow
	Color3.fromRGB(27, 42, 53),--Black
	Color3.fromRGB(242, 243, 243), --White
	Color3.fromRGB(140, 91, 159),--Purple
	Color3.fromRGB(124, 92, 70),--Brown
	Color3.fromRGB(18, 238, 212),--Teal
	Color3.fromRGB(0, 255, 0),--Lime
}




game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		
		local Parts = char:GetChildren()
		local RandomColor = ColorTable[math.random(1,#ColorTable)]
		for i = 1,#Parts do
			if Parts[i].ClassName == "MeshPart" or Parts[i].ClassName == "Part" or Parts[i].ClassName == "Union" then
				Parts[i].Color = RandomColor				
			end
		end
	end)
end)

3 comments

0

im new to here so ignore the format

0

"--" acts as a comment on each line, so ignoring the lack of formatting on this post, your table only includes 5 colors excluding the line that starts with "Blue" because that is invalid..

0

And the first answer given should work, so to make sure you've got it ticked on all unions, you should just set that property before you change the color to be sure.

3 answers

✓ Accepted answer

Actually it's:

Parts[i].ClassName == "UnionOperation"

for some reason. Also yes, you need to tick UsePartColor. Just to let you know, if your unions are multi-coloured, it will mess them up.

On the union, tick the use part color option. See if that works.

1 comment

0

sorry but it doesnt work

I'm guessing you're trying to randomly change the color of the unions? If there's no errors and it's not changing color this is probably because unions colors can't be changed unless you tick off a specific property in the union. To do this, go into the properties of the unions and tick off usepartcolor (I believe that's the one) and it should work.

1 comment

0

still doesnt work

This discussion is preserved as it was. New answers, comments, and votes are closed.