How can I change a player's skin tone color with a GUI button?

I want to be able to have my players have a GUI on their screen for my tanning place. When they click an option, I want their skin tone to change as if they were tan. I’ve looked for tutorials and on the Developer Forum, but I can’t find any solution. I don’t know where to start as I am a new scripter and not having a tutorial to learn from and follow makes it hard to start.

3 Likes

How do you think it would logically work? Is a good starting point.

Button pressed connect it to a remote event send the color through the remote event pick up the remote event on the server and change skin tone depending on the color sent via the remote.
Edit pseudocode is the best way to make any script. Hope this helps!

1 Like
  1. When you are more advanced you could make a color picker, but for now I would just have 10 or so buttons that all have different colors. Put those text buttons in a folder. Now change the background color on each text button. When you press the “Red” text button we want their skin to turn red. We do this by setting their character’s color to the color of the textbutton.

  2. Loop through all of the buttons, and when they are pressed fire a remote event to the server, and tell the server what color we want.

  3. On the server, when the event is fired, loop through every part in the player’s character and change it.

Local Script

local folder = --define folder with the text buttons
local remote = game.ReplicatedStorage:WaitForChild("") --define remote here

for i, button in pairs(folder:GetChildren() do
        if button:IsA("GuiButton") then
               button.MouseButton1Up:Connect(function()
                         print("Changing Color")
                          remote:FireServer(button.BackgroundColor3)
                end)
        end
end

Server Script

local remote = game.ReplicatedStorage:WaitForChild("") --define remote event here (same remote as local script)

remote.OnServerEvent:Connect(function(player, color)
          for i, part in pairs(player.Character:GetChildren()) do
              if part:IsA("BasePart") then
                     part.BrickColor = color
              end
          end
end)
5 Likes