as always, the question sounds confusing but what i'm saying is that, how do I change the color of the part in the custom character (lets say like Torso for example when ever a player respawns it changes color). I'm trying to change up the hat color I've added on my custom character for player to play as. Each time they respawn, the hat changes colors but my scripting seems a bit off, and it's not working.
```lua local Players = game:GetService("Players")
local function onCharacterAdded(character)
character.ShadowMaskGiver.Color.BrickColor.BrickColor = BrickColor.Random()
end```
It seems like you are not firing the function, instead try this:
local plr = game:GetService("Players") plr.PlayerAdded:wait() --- i think this line is not needed but just in case plr.LocalPlayer.CharacterAdded:Connect(function(char) character.ShadowMaskGiver.Color.BrickColor.BrickColor = BrickColor.Random() end)
or if you want something longer you can try:
game:GetService("Players").PlayerAdded:Connect(function(plr) plr.CharacterAdded:Connect(function(char) character.ShadowMaskGiver.Color.BrickColor.BrickColor = BrickColor.Random() end) end)
either that or you can simply add this line at the bottom of your script, this line fires your function:
Players.LocalPlayer.CharacterAdded:Connect(OnCharacterAdded)