been trying to figure this out for some time now, i think it has something to do with the player? the problem is line 11 up to line 24 (so the player.Character:FindFirstChild("Body Colors")._______ = BrickColor.new(brickcolor)
local skin = script.Parent.Value.Value local player = game.Players.LocalPlayer if skin == 1 then brickcolor = ("Pastel brown") end if skin == 2 then brickcolor = ("Nougat") end if skin == 3 then brickcolor = ("Dirt brown") end if skin == 4 then brickcolor = ("Tawny") end if player:FindFirstChild("Body Colors") == nil then local bc = Instance.new("BodyColors") bc.Name = "Body Colors" player.Character:FindFirstChild("Body Colors").HeadColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftFootColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftHandColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftLowerArmColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftLowerLegCoolor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftUpperArmColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LeftUpperLegColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").LowerTorsoColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").RightFootColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").RightHandColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").RightLowerArmColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").RightLowerLegColor= BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").RightUpperArmColor = BrickColor.new(brickcolor) player.Character:FindFirstChild("Body Colors").UpperTorsoColor = BrickColor.new(brickcolor) end
You'll probably know that if the program is throwing an exception like that, it means something you're trying to index doesn't exist.
In your case, I'd imagine you're trying to find "Body Colors" under the player's character before it's had time to load.
The simple fix is to swap out FindFirstChild()
for WaitForChild()
.
As a side note, you may want to create a variable for Body Colours so your code looks a little bit neater...
local bodyColors = player.Character:WaitForChild("Body Colors")
... and then use that when referencing specific body parts:
bodyColors.HeadColor = BrickColor.new(brickcolor)
Hope that helps.