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

How to change part color3 to gui button backgroundcolor3?

script.ChangedFurColor.OnServerEvent:connect(function(plr)
	if plr.Character:FindFirstChild("SWarriorMorph") then
		local selectedpart = plr.PlayerGui.Customization.ColorScroll:FindFirstChild("Selected")
		local bodypart = selectedpart.BodyPartVal
		local selcolor = plr.PlayerGui.Customization.FurColors:FindFirstChild("SelectedColor").BackgroundColor3
		plr.Character.SWarriorMorph:FindFirstChild(bodypart.Value).Color3 = Color3.new(selcolor.r,selcolor.g,selcolor.b)
	end
end)

The output says the error is on line 7 and Workspace.GuiStuff.Customization.FurColor:7:attempt to index a nil value. How do I change a part color3 to a guibutton backgroundcolor3?

1 answer

script.ChangedFurColor.OnServerEvent:connect(function(plr)
    if plr.Character:FindFirstChild("SWarriorMorph") then
        local selectedpart = plr.PlayerGui.Customization.ColorScroll:FindFirstChild("Selected")
        local bodypart = selectedpart.BodyPartVal
        local selcolor = Color3.new(plr.PlayerGui.Customization.FurColors:FindFirstChild("SelectedColor").BackgroundColor3)
        plr.Character.SWarriorMorph:FindFirstChild(bodypart.Value).Color3 = Color3.new(selcolor.r,selcolor.g,selcolor.b)
    end
end)

You needed to make it a Color3.new :)

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