math.randomseed(tick()) local skinT = {"125", "1030", "18"} local player = game.Players.LocalPlayer while not player.Character do wait() end local character = player.Character local bColors = character:FindFirstChild("Body Colors") if bColors ~= nil then local newskin = skinT[math.random(1,3)] bColors.HeadColor = BrickColor.new(newskin) bColors.LeftArmColor = BrickColor.new(newskin) bColors.RightArmColor = BrickColor.new(newskin) bColors.TorsoColor = BrickColor.new(newskin) bColors.LeftLegColor = BrickColor.new(newskin) bColors.RightLegColor = BrickColor.new(newskin) end
Output isn't giving me any errors, so I'm very confused.
This works. The body colors were being added to the character slightly after the character spawned, so I changed FindFirstChild
to WaitForChild
.
math.randomseed(tick()) local skinT = {"125", "1030", "18"} local player = game.Players.LocalPlayer repeat wait() until player.Character local character = player.Character local bColors = character:WaitForChild("Body Colors") local newskin = skinT[math.random(1,3)] bColors.HeadColor = BrickColor.new(newskin) bColors.LeftArmColor = BrickColor.new(newskin) bColors.RightArmColor = BrickColor.new(newskin) bColors.TorsoColor = BrickColor.new(newskin) bColors.LeftLegColor = BrickColor.new(newskin) bColors.RightLegColor = BrickColor.new(newskin)