Skin color button not working

I am trying to make a GUI button that changes skin color when clicked and for some reason, it’s not working.

I am not receiving any errors or anything.

ServerScript in button:

local GUI = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local player = GUI.Parent.Parent
local char = player.Character

local button = script.Parent
local color = button.BackgroundColor3

button.MouseButton1Click:Connect(function()

	for i, part in pairs(char:GetChildren()) do
		if part:IsA("BasePart") then
			part.BrickColor = BrickColor.new(color)
		end

	end
end)
1 Like

You might want to use the Humanoid Description System. I think though the server script isn’t allowed to run from clients or more specifically guibutton.Activated (the server can’t click buttons only clients!) Try using a local script and firing a remote event

This line of code means that you set the color variable to the background color. So that will be a color3

Since it’s outside of the mousebutton1click it will never change and always be the same color

Have you tried using BodyColors ?
https://developer.roblox.com/en-us/api-reference/class/BodyColors
Please note that if you use a custom rig it probably won’t work.

You shouldn’t be using server scripts to handle UI in any way, this needs to be done in a local script and replicated to the server by using RemoteEvents.

BackroundColor3 is a Color3 value.

BackroundColor is a BrickColor value.

(If I remember correctly)

You can’t have ServerScripts in UIs.

If you want the behaviour to replicate on every client, have the button code itself in a LocalScript which later fires a RemoteEvent to a ServerScript which does the changes.