How would i check if an instance has an attribute?

Hello, i am wondering how I would check if an instance has an attribute, as when i try, it only works if the attribute is set to true I dont know why tho.

	local tabled = workspace:GetPartBoundsInBox(hitbox.CFrame, hitbox.Size)
	
	for i, v in tabled do
		local parent = v
		while parent do
			if parent:IsA("Model") and (parent:GetAttribute("Vulnerable")  == true or parent:GetAttribute("Vulnerable")  == true) then
				local highlight = parent:FindFirstChild("Highlight")
				print("found")
				if highlight then
					highlight:Destroy()
				end
				
				for i, v in parent:GetChildren() do
					if v:IsA("BasePart") then
						v.Anchored = false
					end
				end
				parent:SetAttribute("Vulnerable", nil)
				destroyedEvent:Fire()
			end
			parent = parent.Parent
		end
	end

the whole script works perfectly fine, its just that it only prints "found" if the attribute is true, when i want it to print found when the attribute is there, no matter the value.
Thanks!

Never mind everyone, i js realised i put
if parent:GetAttribute("Vulnerable") == true
twice when i wanted it to check if it was false as well.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.