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

Why is this script only changing the characters body color to black?

I'm making a character customization GUI and when the player chooses his skin color I use a color3 value and a mousebutton1click to get change the value. Output also gives me nothing.

I tried using prints to find the error but everything works fine

LocalScript that changes the Color3 value

main = script.Parent
mainFrame = main.Frame
colorChosen = script.Parent:WaitForChild("Color")

for i,v in pairs(mainFrame:GetChildren()) do
	print("k")
	if v and v:FindFirstChild("TextButton") then
		v.TextButton.MouseButton1Click:connect(function()
			colorChosen.Value = v.TextButton.BackgroundColor3
			print("color changed")
			script.Parent.ColorChanger.Disabled = false
			mainFrame.Visible = false
			wait(1)
			script.Parent.ColorChanger.Disabled = true
		end)
	end
end

LocalScript that changes the body colors of the player

color = script.Parent.Color.Value

local character = game.Players.LocalPlayer.Character
while script.Disabled == false do	
	print("h")
        character["Body Colors"].HeadColor3 = Color3.new(color)
        character["Body Colors"].LeftArmColor3 = Color3.new(color)
        character["Body Colors"].LeftLegColor3 = Color3.new(color)
        character["Body Colors"].RightArmColor3 = Color3.new(color)
        character["Body Colors"].RightLegColor3 = Color3.new(color)
        character["Body Colors"].TorsoColor3 = Color3.new(color)
		wait(.1)
	end

1 answer

Try putting "Color3.new(color.Color)" because if "color" is a BrickColor, then it doesn't automatically convert itself to a Color3 just because it's in the parentheses. http://wiki.roblox.com/index.php?title=API:Color3 I hope this helped :)

3 comments

0

its not a brickcolor its a color3value

0

Alright, then try "Color3.new(color.X / 255, color.Y / 255, color.Z / 255)" because Color3Values determine colors with numbers between 0 and 255, while as Color3.new expects numbers between 0 and 1.

0

ohhh thanks i didnt know that!

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