Tool ID To Open Different Doors

Hello, I want to use a tool to open a door, I have different doors and different cards for different players, I wanted to include an ID in the keycard to make a door open, but I don’t know how to make a door check the keycard ID (which is in a script inside the keycard)

This is the script:

This is the script:

local function OnCardTouch (Hit)
	local Real = Hit:FindFirstChild("Keycard")
	if Real then
		script.Parent.Parent.Door.Transparency = 1
		script.Parent.Parent.Door.CanCollide = false
		wait(5)
		script.Parent.Parent.Door.Transparency = 0
		script.Parent.Parent.Door.CanCollide = true
	end
end
script.Parent.Touched:connect(OnCardTouch)

I already checked the forum and youtube and I can’t find anything, so I’m creating a new Topic, please help me :smiley:

You are finding the tool in workspace but not in the players backpack, so how will it work if you can’t use it

Its working right now with this code, because it activates when it detects a hit with the card on the hand, I only wanted to make it check an ID, and if its the right ID then “Real” activates

you can create a StringValue inside the keycard and use it as the id

local doorId
local Real = Hit:FindFirstChild("Keycard")
	if Real then
        local cardId = Real.StringValue.Value
        if cardId == doorId then
            --open
        end
    end
1 Like

Oooooh Thanks I forgot that, I owe you one :smiley:

1 Like