[SOLVED] How do I change players part color?

Before you go hard on me I just want to say that I am a beginner and I need more time to understand what I am supposed to do.

  1. What do you want to achieve? Keep it simple and clear!

I want to make a GUI that can change players color.

  1. What is the issue? Include screenshots / videos if possible!

Everytime I try it, it does not change the color.

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Yes I did, I even used print to see if it even does anything.

local remoteEvent = game.ReplicatedStorage:WaitForChild("ColorChange")

for i, button in pairs(script.Parent:GetChildren()) do
	if button:isA("TextButton") then
		button.MouseButton1Click:Connect(function()
			remoteEvent:FireServer(button.BackgroundColor3)
			print("Changed color")
		end)
	end
end
local remoteEvent = game.ReplicatedStorage:WaitForChild("ColorChange")

remoteEvent.OnServerEvent:Connect(function(player, color)
	for i, v in pairs(player.Character:GetChildren()) do
		if v:IsA("Color1") then
			v.BrickColor = BrickColor.new(color)
		end
	end
end)

I’m quite sure it’s because of GetChildren()) however I am not really confident.

I should also mention that the part color I am trying to change is inside a model and inside the player.

SnĂ­mek obrazovky 2023-04-24 194615

Multiple things wrong here.

Change player.Character:GetChildren() to player.Character:GetDescendants(), then change v:IsA("Color1") to v.Name == "Color1", and then change v.BrickColor = BrickColor.new(color) to v.Color = color

So something like this?

local remoteEvent = game.ReplicatedStorage:WaitForChild("ColorChange")

remoteEvent.OnServerEvent:Connect(function(player, color)
	for i, v in pairs(player.Character:GetDescendants()) do
		if v.Name == "Color1"
			v.Color = color
		end
	end
end)

Yes.

Just be sure to add the “then” back to the end of this line

1 Like

Thank you so much this actually worked!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.