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

If statement's multiple layers problem ('and' and 'or')?

Asked by 6 years ago

I find this really annoying, these are code that make everything in the character go transparent but the right arm parts, but it just makes the whole character goes transparent. For example, if I type like this:

if v:IsA("BasePart") and (v.Name ~= 'RightHand' or v.Name ~= 'RightUpperArm' or v.Name ~= 'RightLowerArm')  then

or this:

if v:IsA("BasePart") and ((v.Name ~= 'RightHand') or (v.Name ~= 'RightUpperArm') or (v.Name ~= 'RightLowerArm'))  then

or even this:

if v:IsA("BasePart") and ((not v.Name == 'RightHand') or (not v.Name == 'RightUpperArm') or (not v.Name == 'RightLowerArm'))  then

or even this one:

if v:IsA("BasePart") and (not (\v.Name == 'RightHand') or not (v.Name == 'RightUpperArm') or not (v.Name == 'RightLowerArm'))  then

All of those still makes the entire character disappear, if you are an expert about these if statement stuff then please let me know how to do it.

2 answers

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago
Edited 6 years ago

This should work; try it.

if v:IsA("BasePart") then
    if not (v.Name == "RightHand" or v.Name == "RightLowerArm" or v.Name == "RightUpperArm") then
        v.Transparency = 1
    end
end
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago
if v:IsA("MeshPart") then
    if v.Name == "RightLowerArm" or if v.Name = "RightHand" or if v.Name = "RightLowerArm" then return end
end
0
wrote this on a phone plz tell if works thanks AttentionHog 70 — 6y
0
That's not how the if statement works. RubenKan 3615 — 6y
0
forgot im mobile but thx AttentionHog 70 — 6y

Answer this question