Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Keycard reader event fires when anything touches it, not the thing I want it to touch?

I'm trying to make a keycard reader open a door, but now everything that touches it makes the door open! Anyone able to help?

script.Parent.CardReader.Scanner.Touched:Connect(function(hit)
	if hit.Parent.Name == "O5 Keycard" or "Class-D Keycard" then
		tween:Play()
		debouce = true
		wait(3.5)
		tween2:Play()
                debounce = false
	end
end)

5 comments

0

the last debounce line got a bit messed up on the website

0

Are you trying to make it for only humanoid to touch? Or what?

0

the 2n line says the tool i want to touch it

0

Is it a local script?

0

nope

1 answer

✓ Accepted answer

Let’s try a LOCAL SCRIPT in the tool, but let’s try it this way

script.Parent.CardReader.Scanner.Touched:Connect(function(hit)
	  Door = script.Parent  
        if hit.Parent == door and hit.Parent.Name = “O5 Keycard" or "Class-D Keycard" then
	     tween:Play()
       debouce = true
        wait(3.5)
        tween2:Play()
	              debounce = false
      end
end)

Lets try that.

10 comments

0

So, the localscript goes in the tool?

0

Ye.

0

But the card reader is not in the tool?

0

It isn’t?

0

The cardf reader is in the door model. The tool is is StarterPack

0

Ohhhh

0

You got any ideas?

0

Yes I edited the script.

0

Alright, I had to do a little tweaking to the script, but it works now! Thanks for your help!

0

Thank so much :))

This discussion is preserved as it was. New answers, comments, and votes are closed.