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)
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
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.
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.