Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I want people to have a random colored body but it doesn't work?

I am trying to make it so your torso, legs, arms, and everything is randomly colored but it isn't working

local RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))

local Player = game:GetService("Players")
Player.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.Head.Color = RGB
	    RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.LeftUpperLeg.Color = RGB
		RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.LowerTorso.Color = RGB
		RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.RightLowerArm.Color = RGB
		 RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.LeftFoot.Color = RGB
		RGB = Color3.new(math.random(0, 255), math.random(0, 255), math.random(0, 255))
		character.LeftFoot.Color = RGB
	end)
end)

2 comments

0

replace Color3.new with Color3.fromRGB or divide each of the random value by 255

0

it doesnt work

1 answer

game.Players.PlayerAdded:Connect(function(plry)
	local char = plry.Character or plry.CharacterAdded:Wait()
	local clr = BrickColor.Random()
	local bc = Instance.new("BodyColors")
	local origbc = char['Body Colors']
	origbc:Destroy()
	wait(0.1)
	bc.HeadColor = clr
	bc.LeftArmColor = clr
	bc.LeftLegColor = clr
	bc.RightArmColor = clr
	bc.RightLegColor = clr
	bc.TorsoColor = clr
	bc.Parent = char
end)

Put in a server script in ServerScriptService or Workspace.

1 comment

0

Btw I tested it.

This discussion is preserved as it was. New answers, comments, and votes are closed.