Get player in server script

I have returned to scripting after a couple month break
I need help with changing the color of a roblox player

image

Basically I need help to find a way to get the player character

Thanks.

Shouldnt pressing a button be happening on the client? After a button is pressed you can fire a event to the server that passes the player and allows you to change the player’s character color

  1. do what @smash_able said (RemoteEvent | Roblox Creator Documentation)
  2. use bodycolors to change the skin tone of each limb
  3. welcome back :slight_smile:

The button.MouseButton1Click has no parameters unlike click detectors.
So you have to make it in local script.
But you will worry about the color showing only to yourself.
However, you dont have to worry about it.
The local player has the network ownership of the character so the ClientReplicator will accept you to change it in server.

So it would be like this.

local button = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
button.MouseButton1Click:Connect(function()
for i,v in pairs(character:GetChildren()) do
-- your codes
end
end)

Thanks! its works perfectly as planned

1 Like

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