Hello, I need some help. I'm trying to make a face changing GUI where, when the player clicks the Image Button in the GUI, their avatar's face will change to match the image they clicked.
This is what I got so far:
function applyFace(plr)
local h = plr.Character:findFirstChild("Head")
if h~=nil then
h.face.Texture = script.Parent.Image
end
end
script.Parent.MouseButton1Click:Connect(applyFace)
For some reason, when I click on the face button, the output windows says "attempt to index nil with Character". Any idea on how to fix it?

5 comments
plr is nil.
Yeah umh, and what should I do about it? No idea how to set "plr" to an actual player.
MouseButton1Click doesn't have a parameter for the player
Hey you why don't you accept the person's answer if he helped you
I completely forgot to, my bad! Accepted.