I'm trying to change the color of armor with specific names using a GUI. The problem is that when I click the part, it shows an error saying "attempt to index local 'player' (a nil value)".
script.Parent.MouseButton1Click:Connect(function(player)
local target="PrimaryColor"
local char = player.Character
for _,p in ipairs(char:GetDescendants()) do
if p.Name=="Primary" then
p.Color=script.Parent.Parent.Frame.Picker.Colour.BackgroundColor3
end
end
end)

5 comments
That might be it. I've tried using regular scripts and localscripts and it hasn't worked. Could you elaborate a bit on how to use events to complete this task? I don't have much experience with Roblox's lua.
Sure, give me a bit.
Is the armour just in the game.Workspace.Player?
Yeah, it is. Sorry for the late reply
Okay, so apparently I don't know either haha. You'd have to look up events on Google or ask for some help in the Discord.