Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
kuru226 13
2 years ago
Edited 2 years ago
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

Log in to vote
0
Answered by 2 years ago

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!

1
THANK YOU!!! kuru226 13 — 2y
0
I didnt know that at all, tysm!! kuru226 13 — 2y
0
Np strangejmaster43 139 — 2y
Ad

Answer this question