The script is working and not working

Basically, I wanted to make a script that changes MY character’s face into the meanie face (don’t ask why lol)

This script does the steps, and prints everything. But doesn’t replace the face…

Anyways, here is the script:

local myid = 1795023834
game.Players.PlayerAdded:Connect(function(plr)
	if plr.UserId == myid then
		print("1")
		plr.CharacterAdded:Connect(function(char)
			if char.Name == "lV0rd" then
				print("2")
				char.Head.face:Destroy()
				print("3")
				local newface = script.meanie:Clone()
				newface.Parent = char.Head
				print("4")
			end
		end)
	end
end)

It does print 1, 2, 3, and 4 and there are no errors.

2 Likes

have you checked the decal’s transparency?
it might cause the issue

Your code seems perfectly fine, I can think of many possibilities as to why this is seemingly not working. But I’ll start by saying, there is no reason to delete the face object and create a new one, you can just copy the Texture ID from ‘meanie’ and set char.Head.face’s value to be that.

local newfaceID = script.meanie.Texture
char.Head.face.Texture = newfaceID

I did the same thing and the result is always the same. Kinda getting pissed now.

image

image

you put 1V0rd but your name is IV0rd

Maybe change that?

If it wasn’t lV0rd, it wouldn’t print the number 2. Lol.

Lmao welcome to game development/coding in general, it’s largely just debugging :stuck_out_tongue:
Kinda silly but just making sure: Are you certain that the ‘meanie’ decal is actually the meanie face and not the exact same image as the face before?

Yes, it is I checked like a quantrillion times.

This is a bit of a guess, so I might be very wrong here but try moving this code so that its called from the CharacterAppearanceLoaded event, not CharacterAdded

I think this runs when your entire character appearance has been set

3 Likes

Now that works, thank you so much!

1 Like