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

How can I change the colors of armor parts in a player using a GUI?

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)

This is what the armor looks like.

Here is the GUI, for context.

1 answer

If I recall correctly, you can't use LocalScripts to change block's properties. You'd have to use events instead.

Not sure if this is the cause of the error, but maybe something you could try.

5 comments

0

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.

0

Sure, give me a bit.

0

Is the armour just in the game.Workspace.Player?

0

Yeah, it is. Sorry for the late reply

0

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.

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