Problem with GetChilder(Door key card) and (Bypass Level Accept Card)

  1. What do you want to achieve?
    So here the idea
    I wanna copy and paste (Door) {and it’s need be work}
    but here the problem… in code i need copy and paste Script TO!
    How can i make just copy and paste Model and it’s gonna be work

  2. What is the issue?
    Model–
    eeee

ee
code

local KeyCardDoor_1 = workspace.World.Levels:FindFirstChild("Accept_Level_1")

local debounce = false

local door1 = KeyCardDoor_1.Door_1
local Scanner = KeyCardDoor_1.Scanner_1

local Card_AcceptLevel1 = {
	"Level_1",
	"Level_2"
}
-- LOCAL CARD_ACCEPTlevel1 IT'S TOOLS! {Like model Card}
local function DoorAnimation(Part)
	Part.CanCollide = false
	Part.Transparency = 0.5
	debounce = true
	wait(2)
	Part.CanCollide = true
	Part.Transparency = 0
	debounce = false
end

local function CheckDoorTest(hit, Type_Accept_Level)
	if not debounce then
		if not  table.find(Type_Accept_Level, hit.Parent.Name) then return print("BOO") end
		if table.find(Type_Accept_Level, hit.Parent.Name) then
			print("Accept")
			
		end
	end
end


--for _, Levels in ipairs(game.Workspace.World.Levels:GetChildren()) do
	--if Levels:IsA("Folder") and Levels.Name == "Accept_Level_1" then
	--	local Scanner_1 = Levels:FindFirstChild("Scanner_1")
		--local Door_1 = Levels:FindFirstChild("Door_1")
	--	Scanner_1.Touched:Connect(CheckDoorTest, Accept_Level_1)
		--DoorAnimation(Door_1)
	--end
--end
  -- HERE I TRY MAKE IT WORK




Scanner.Touched:Connect(CheckDoorTest)
  1. What solutions have you tried so far? I try use GetChilder but then i problem with “Accept Level Card” it’s big problem i can’t make 5 types of Accept Level bypass Card key doors

What is type accept level?
strong text

i think touched only returns a value which is hit part

Sorry for aswer you now “It’s tools card”

An easy fix is to add a Script in the model, go to the Script’s properties, go to RunContext and pick Client, then paste your original code there. This makes the script work on client while being located under workspace. Then you can simply clone the whole model.

But how can i make Door open not only for 1 player like server need see it to

Oh i get it what you mean… No i need put in in only 1 script

In that case you just need to use a regular Script. Do the steps I said but without changing RunContext.

If you want to use 1 script for all doors just loop through all doors and make touched events for their scanners. Do you know how to code? If not, I think ChatGPT can easily do this. I’m not on pc right now so I can’t write.

local KeyCardDoor_1 = workspace.World.Levels:FindFirstChild("Accept_Level_1")

local debounce = false

local door1 = KeyCardDoor_1.Door_1
local Scanner = KeyCardDoor_1.Scanner_1

local Card_AcceptLevel1 = {
	"Level_1",
	"Level_2"
}

local function DoorAnimation(Part)
	Part.CanCollide = false
	Part.Transparency = 0.5
	debounce = true
	wait(2)
	Part.CanCollide = true
	Part.Transparency = 0
	debounce = false
end

local function CheckDoorTest(hit)
	if not debounce then
		if not  table.find(Card_AcceptLevel1, hit.Parent.Name) then return print("BOO") end
		if table.find(Card_AcceptLevel1, hit.Parent.Name) then
			print("Accept")
		end
	end
end


for _, Levels in ipairs(game.Workspace.World.Levels:GetChildren()) do
	if Levels:IsA("Folder") and Levels.Name == "Accept_Level_1" then
		local Scanner_1 = Levels:FindFirstChild("Scanner_1")
		local Door_1 = Levels:FindFirstChild("Door_1")
		Scanner_1.Touched:Connect(CheckDoorTest)
		DoorAnimation(Door_1)
	end
end


> Problem

you can see here he see “Card Levels” but he opened doors with not Tocuhed he open door by hes self

This is because you use the variable door1 for all doors. So door1 of level 1 would always open when touching another door. Ask ChatGPT to fix this.