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

How to make high level keycards to access low level doors?

I need it so high level access can access low level doors.

script.Parent.Touched:Connect(function(Hit)
	local CheckIfCard = Hit.Parent:GetDescendants()

	for i,v in pairs(CheckIfCard) do
		if v:IsA("Tool") and v.Name == "Low Level Access" then
			script.Parent.CanCollide = false
			script.Parent.Transparency = 0.5
			wait(3)
			script.Parent.CanCollide = true
			script.Parent.Transparency = 0 
		end
	end
end)

2 answers

I"m not sure if this will work, but try

local cards = {"Low Level Access", "Medium Level Access", etc}
script.Parent.Touched:Connect(function(Hit)
    local CheckIfCard = Hit.Parent:GetDescendants()

    for i,v in pairs(CheckIfCard) do
        if v:IsA("Tool") and v.Name == cards then
            script.Parent.CanCollide = false
            script.Parent.Transparency = 0.5
            wait(3)
            script.Parent.CanCollide = true
            script.Parent.Transparency = 0 
        end
    end
end)

Create a module script and put it inside the keycard. Give it a variable level, for example:

keycardLevel = 2

and give the door a level in the main script,

doorLevel = 1

and inside the door, check if the card is equal to or higher than like so:

Variable = require(keycard.modulescriptname)
if Variable.keycardLevel >= doorLevel then

and open the door or whatever you were doing.

1 comment

0

Sorry I'm still a beginner in scripting I don't really understand what to do.

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