Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How Can I spawn people of random colors?

Asked by 6 years ago

I has been trying but I dont have the case, Those are the first time I am learing to script.

1 answer

Log in to vote
0
Answered by
Jellyfosh 125
6 years ago

You can do this using a script in ServerScriptService, along with the following: PlayerAdded PlayerAdded will return Player

You can then use Player to find when their character is spawned using CharacterAdded. This will return the player's character.

then use:

for i,v in pairs(character:GetChildren()) do 
if v:IsA("Part") then

end

This will go through every item inside of a player's model and see if it is a part. v stands for what item is being checked. If v passes the test and IS a part, then you can use BrickColor.random() to give the part a random color.

v.BrickColor = BrickColor.random()
Ad

Answer this question