Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to change part color3 to gui button backgroundcolor3?

Asked by 6 years ago
Edited 6 years ago
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

Log in to vote
0
Answered by
Nowaha 459 Moderation Voter
6 years ago
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 :)

Ad

Answer this question