i got this function for a script from the community chat to wait for the character to spawn before the script ran. i tested it, works fine in test mode, but not in the actual mode. this script should be in a local script. correct me if i'm wrong.
local player = script.Parent.Parent
local char = player.Character
local run = false
player.CharacterAdded:connect(function(char)
if not run then
run = true
local Colors = {"Light orange", "Nougat", "Brown", "Sand red", "Brick yellow", "Medium red", "Light reddish", "Bright violet", "Light stone", "Medium stone grey", "Black", "Bright red", "Pastel blue", "Dark stone grey", "Bright blue", "Bright greem", "Br. yellowish green", "Sand green", "Reddish brown", "Dark green", "Light blue", "Cool yellow", "Medium green", "Earth green", "Bright orange", "Br. yellowish orange", "Dark orange", "White", "Sand blue", "Bright yellow", "Bright bluish green", "Medium blue",}
local radColor = math.random(1, #Colors)
char["Left Arm"].BrickColor = BrickColor.new("Cool yellow")
char["Right Arm"].BrickColor = BrickColor.new("Cool yellow")
char.Head.BrickColor = BrickColor.new("Cool yellow")
char["Right Leg"].BrickColor = BrickColor.new("Pastel Blue")
char["Left Leg"].BrickColor = BrickColor.new("Pastel Blue")
char.Torso.BrickColor = BrickColor.new(Colors[radColor])
end
end)

7 comments
btw the script is parented in starterpack so it can repeat when the player dies.
Please just put it in a Script in ServerScriptService, and listes to the PlayerAdded event instead.
You could just do BrickColor.random() or whatever it is.
@hiimgoodpack im making an old roblox game, or making it look old. back then, they only had 32 colors. it makes it a lot harder to choose different colors randomly.
local radColor = Colors[math.random(1,#Colors)]
char.Torso.BrickColor = BrickColor.new(radColor)
@pyccknnXakep you're not getting the point, the random coolor crap works, read the question... the FUNCTION is the problem not the script its self