Keycard system bugging out

I want to make it so multiple tools, can open the doors, however, it isn’t working! I have tried using other things and it still is buggy.
Here’s the script, any help would be appreciated!

script.Parent.Parent.Touched:Connect(function(hit)
	if hit.Parent.Name == "Keycard" or "R1" or "R2" then
        for _,v in pairs(workspace.ScienceDoor:GetChildren()) do
		  if v:IsA("BasePart") then
         v.Transparency = 1
         v.CanCollide = false
     script.Parent.BrickColor = BrickColor.Green()
           end
         end
         wait(1)
          for _,v in pairs(workspace.ScienceDoor:GetChildren()) do
		  if v:IsA("BasePart") then
         v.Transparency = .85
         v.CanCollide = true
				script.Parent.BrickColor = BrickColor.White()
			end end 
           end
      end)

Here’s a video.

https://i.gyazo.com/cb28a1f50ee7ec834710352281894c35.mp4

It isn’t meant to open on touch, only with a keycard.

Take a look at this line

if hit.Parent.Name == "Keycard" or "R1" or "R2" then

I believe the confusion comes from "R1" or "R2". Shouldn’t you be checking if the instance name is R1 or R2. Something like this: hit.Parent.Name == "R1" or hit.Parent.Name == "R2"

2 Likes

Thank you! I didn’t know you are supposed to do it again in the script. I thought that or would work. I’ll try it out and see if it works, and it probably will. Again, thank you! I have been stuck on this issue for a week.

1 Like