0

# I am trying to make a random colored head but it doesn't work?

I'm trying to make it so when the user joins, they will have a random colored head. Here's my script

local Player = game:GetService("Players")
end)



1
Edited 1 year ago

There is a typo on line 3, do this instead:

player.Character.Head.BrickColor = BrickColor.random()


remember that function calls are case-sensitive

edit: you should also do this every time the player's character is added because as it stands it will do one of two things:

• give an error because the player is added before the character is
• if the character exists, this will only happen once and if the person dies, resets their character, etc. their head will go back to normal

so try this:

local Player = game:GetService("Players")
end)
end)

0
it still doesn't work. It's a localscript in ServerScriptService. CountOnMeBro 51 — 1y
0
LocalScripts run on the client side and do not work under ServerScriptService. Put this in a regular (server-side) script. You should use Scripts for things you want everyone in the game to see (so, most things), and LocalScripts are mainly for GUIs and other things that are unique to each person OfficerBrah 494 — 1y
0
i put a script in ServerScriptService and it still doesnt work CountOnMeBro 51 — 1y
0
I tested this in Studio and it works when you put wait() before line 4, so I guess Roblox overrides the head's color when the character is initially created and that's why it doesn't work without the wait() OfficerBrah 494 — 1y
0
local Char = game.Players.LocalPlayer.Character