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

What's up with the keycard door script?

I found a sort of anomaly to occur after interaction with the door in game. After you interact with it using the keycard tool that should have access, it plays the 'access granted' sound but the door does not move at all. You also cannot interact with it after that. The script just decides to die. I am not the best at scripting and therefore I don't think I am able to find the anomaly myself, honestly.

What I need help here with is the location of the anomaly that's causing the script to break and potentially a fix to it. It used to work properly but for whatever reason it lacks functionality. I did not mess with the script at all other than the clearance.


The script in question is the one down below:

local Clearance = {
	["[PR] Administrator Access"] = true, 
	["[PR] ?"] = true, 
	["[PR] Oversight Access"] = true,
	["[PR] Executive Access"] = true,
	["[PR] Security Access"] = true,
	["[PR]Employee Access"] = false,
	["[PR] Prisoner Access"] = false
 
}
local r=game:getService("RunService")
local DoorModel = script.Parent
local door = DoorModel.Door 
local door1 = DoorModel.Door1 
local ret = door.CFrame 
local ret1 = door1.CFrame 
local look=door.CFrame.lookVector
require(967624708):Check()
local Inuse=false
local Original=door.Transparency
local Original1=door1.Transparency
function OpenDoors()
	door.AccessGranted:play()
	for i,v in pairs (DoorModel.Lights:GetChildren()) do
		v.brickColor = BrickColor.new("Lime green")
	end
	door.DoorOpen:play()
for i=0,math.pi*2,math.pi/30 do
	r.Stepped:wait()
	door.CFrame=ret+Vector3.new(2.5,0,2.5)*look-math.cos(i)*2.5*look
	door1.CFrame=ret1-Vector3.new(2.5,0,2.5)*look+math.cos(i)*2.5*look
	if string.format("%3.2f",i)=="3.14" then 
		door.Transparency=1
		door1.Transparency=1
		wait(3) 
		door.Transparency=Original
		door1.Transparency=Original1
		door.DoorClose:play()
	end
end
	door1.CFrame = ret1
	door.CFrame = ret 
	for i,v in pairs (DoorModel.Lights:GetChildren()) do
		v.brickColor = BrickColor.new("Institutional white")
	end
 
end
DoorModel.KeycardReader1.touched:connect(function(touch)
	if touch.Name == "Handle" and Clearance[touch.Parent.Name] and not Inuse then
		Inuse=true
			OpenDoors()
		Inuse=false
	elseif touch.Name == "Handle" and not Clearance[touch.Parent.Name] and not Inuse then
		door.AccessDenied:play()
	end
end)
 
DoorModel.KeycardReader2.touched:connect(function(touch)
	if touch.Name == "Handle" and Clearance[touch.Parent.Name] and not Inuse then
		Inuse=true
			OpenDoors()
		Inuse=false
	elseif touch.Name == "Handle" and not Clearance[touch.Parent.Name] and not Inuse then
		door.AccessDenied:play()
	end
end)
 

https://gyazo.com/b7fc788dd2e29b1217b3b03dd99c51eb (this is how the model looks like)

3 comments

0

Any errors in the output?

0

https://gyazo.com/3e13fa35c667cf71f124f923876fb1f4 Just now did I find this one bit...

0

"An anti-leak script from back in the day. Doesn't do anything anymore but you might still find it in some stolen models, I promise I don't make viruses."

1 answer

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