Why is this not working? I'm trying to create a script that will give the player a random skin color on entry of the game.
colourstochoosefrom = math.random(1,2)
if colourstochoosefrom == 1 then
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Head.face.Texture = "rbxassetid://28257733"
local bodycolors = Instance.new("BodyColors", plr)
bodycolors.RightArmColor = BrickColor.new("red")
bodycolors.LeftArmColor = BrickColor.new("red")
bodycolors.LeftLegColor = BrickColor.new("red")
bodycolors.RightLegColor = BrickColor.new("red")
bodycolors.TorsoColor = BrickColor.Random()
bodycolors.HeadColor = BrickColor.new("red")
end
if colourstochoosefrom == 2 then
game.Workspace.ChildAdded:connect(function(plr)
local name = plr.Name
local playerinplayers = game.Players:FindFirstChild(plr.Name)
if playerinplayers ~= nil then
playerinplayers.CanLoadCharacterAppearance = false
plr.Head.face.Texture = "rbxassetid://28257733"
local bodycolors = Instance.new("BodyColors", plr)
bodycolors.RightArmColor = BrickColor.new("blue")
bodycolors.LeftArmColor = BrickColor.new("blue")
bodycolors.LeftLegColor = BrickColor.new("blue")
bodycolors.RightLegColor = BrickColor.new("blue")
bodycolors.TorsoColor = BrickColor.Random()
bodycolors.HeadColor = BrickColor.new("blue")
end

6 comments
Please format your code
Please format your code? How do I do that?
dude, when you ask a question, it says lua at the top, inside the ~~~~~~~~~ area, put your code..
oh ty dude
I re-did it
All I can think of rn is that you did not name the body colors correctly. I've never heard of bodycolors but if it's anything like BrickColor then you should most definitely make sure it's spelled correctly, as most everything in code is CaSe SeNsItIvE