I need to change the players body color once they spawn. I've tried many things like..
game.Workspace.newluigibro.Head.BrickColor = BrickColor.new("Bright Yellow")
or
game.Workspace.Player.Head.BrickColor = BrickColor.new("Bright Yellow")
I kept on getting errors like "newluigibro is not a valid member of Workspace" "Player is not a valid member of Workspace"
Any help?
You need to wait() for yourself OoOoOooo SPooKY anyways, try this..
game.Players.PlayerAdded:Connect(function(p) wait(.5) local char = p.Character for _, v in pairs(char:GetChildren()) do if v.ClassName == "Part" then v.BrickColor = BrickColor.new("Bright Yellow") end end end)
Also, If you cannot see the face, just remove the accessories from the player ;o
What I did: When the player is added, it waits .5 just in case the character wasn't added, then it runs a loop in the character hoping to find the legs, the head, arms, etc cause you said "body color" and not "head color" and then I change it to bright yellow.. YEEET
The issue you have is more likely to be that the script ran before the character was even there. You don't need to do game.Workspace.newluigibro
since there is a property of the Player's instance which is player.Character
which returns the actual player. To accomplish what you are trying to do you can use the event player.CharacterAdded
which is fired every time the player's character is spawned in.
game.Players.PlayerAdded:Connect(function(player) -- fires every time a new player joins. player.CharacterAdded:Connect(function(character) -- event of player which returns the character local head = character:WaitForChild("Head") -- Waits for the head to be added head.BrickColor = BrickColor.new("Bright Yellow") -- Sets the head to the new BrickColor, Bright Yellow! end) end)