If else only firing if true (not running else when conditions are met)?

Hey all,

I am running some code that will detect if you have a certain ShirtGraphic (t-shirt) and if you don’t, then it will kill you, if you do, then it will print “Disguised.” My code prints disguised WHEN THE PROPER CONDITIONS ARE MET, however, if they aren’t, it prints nothing nor does it (seemingly) execute code.

	if touched.Parent:IsA("Model") and touched.Parent:FindFirstChild("Humanoid") then
		if touched.Parent:FindFirstChild("shirtDetection") then
		local shirtId = touched.Parent:WaitForChild("shirtDetection").Graphic
			if string.find(shirtId, "my id") then
				print("Must've not disguised, killing".. touched.Parent.Name)

What’s strange is how scripting the else part is usually easier because it’s whatever didn’t happen (usually), but this time its not running. My logic is right on this one, but the else statement won’t run. (as stated previously, if the player is “disguised,” then it does print “disguised.” If the player isn’t disguised, meaning they do not have the shirt, then it doesn’t print or kill the player/break the joints of the model

If condition is met,it should write Disguise. Did you try to put print(string.find(shirtId, "my id")) before condition or print shirt id? Its just strange that you try to find ‘my id’ if roblox asset ids looks like this

Oh, I see the problem! If there is no shirtDetection, then it doesn’t run the inner if statement (the one responsible for printing the stuff)

p.s: the id is my id lol, didn’t wanna give it and don’t wanna change it now

You can return nothing if there’s no shirt Detection