My ~= breaking when there are more then 1 options

so I am making a ragdoll system, the code below is changing the default joints into custom ones, but I want some joints to not be changed and I am using names to do that, so when I have done the if v.Name ~= "Neck" it works but when I do something like if v.Name ~= "Neck" or v.Name ~= "RightWrist" it just ignores it and won’t do the neck or wrist

if v:IsA("Motor6D") and char.Humanoid.RigType == Enum.HumanoidRigType.R15 then-- adding an attachment and constraint for each 
			if v.Name ~= "Neck" then
				local attachment1 = Instance.new("Attachment")
				local attachment0 = Instance.new("Attachment")

				attachment0.Name = "Attachment0"
				attachment1.Name = "Attachment1"


				attachment0.CFrame = v.C0
				attachment1.CFrame = v.C1
				attachment0.Parent = v.Part0
				attachment1.Parent = v.Part1



				local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want

				constraint.Attachment0 = attachment0
				constraint.Attachment1 = attachment1
				constraint.Parent = v.Part0

				v:Destroy()
			end

		elseif v:IsA("Motor6D") and char.Humanoid.RigType == Enum.HumanoidRigType.R6 then
			local attachment1 = Instance.new("Attachment")
			local attachment0 = Instance.new("Attachment")

			attachment0.Name = "Attachment0"
			attachment1.Name = "Attachment1"


			attachment0.CFrame = v.C0
			attachment1.CFrame = v.C1
			attachment0.Parent = v.Part0
			attachment1.Parent = v.Part1



			local constraint = Instance.new("BallSocketConstraint") -- change to BallSocketConstraint if you want

			constraint.Attachment0 = attachment0
			constraint.Attachment1 = attachment1
			constraint.Parent = v.Part0

			v.Part0 = nil
		end	

Thank you everyone a solution has been found and i now understand my mistake as many commenters have told me, thank you all.

1 Like

Try adding the excluded phrases such as “Neck” and “RightWrist” and use table.find. Would look like this

local TableOfPhrases = {"Neck", "RightWrist"}

if not table.find(TableOfPhrases, v.Name) then 
-- code here
1 Like

It should be

v.Name ~= "Neck" and v.Name ~= "thing"

Pretty sure op wants it to be an or statement. Might be wrong.

1 Like

No, the and statement would make the code work. The way he had it set up, if it were the “Neck” it would be

if false or true then

which would then pass the condition, but if it was the and like @Local_LettuceGiver said it should be, it would return

if false and true then

which would make it not pass the condition.

You could try printing v.Name.
Also what is calling this section of script?

Correct me if I am wrong, but let’s say it is Neck and NOT RightWrist, it wouldn’t work because they both need to be true in an “and” statement?

That’s exactly what the OP was going for was it not? They didn’t want the Neck and RightWrist to be affected.

Yeah I think i misread. I thought they wanted the code to run if either one of them was false not both.