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

Hello!! I was trying to make it where if NOT named "HitboxForBackStabs" THEN the function activates?

function onTouchedNotHit(part) 
	if part.Name == "HitboxForBackStabs" then --//Im Trying To Make It Where If A Part ISNT Named "HitboxForBackStabs" Then This Function Takes Effect, How Do I Do That?

script.Parent.Parent.Parent.Head.MISSPart.BillboardGui.TextLabel.TextTransparency = 0
			wait(1.5)
			script.Parent.Parent.Parent.Head.MISSPart.BillboardGui.TextLabel.TextTransparency = 1
			print("Missed Enemy")
		
	end 
end 

script.Parent.Touched:connect(onTouchedNotHit) 

1 answer

✓ Accepted answer

Just change the == equals operator to a not equal to operator ~=. This is a little bit confusing since most programming languages' not equal to operator is this != but in LUA it's ~=. The end code would change line 2 to this if part.Name ~= "HitboxForBackStabs" then.

Really hope this helped! If you have any questions just comment on this answer. If this did solve the problem please mark this as the answer. Have a good day!

3 comments

1

THANK YOU!!!

0

I didnt know that at all, tysm!!

0

Np

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