The Issue
Hi, I've been experimenting on swinging doors (automatic doors powered by CFrame) and have the scripts and mechanics working for both normal doors and doors that require a certain group rank to access. I am now trying to make a new door that only lets players in if you have a certain tool in your backpack. I did use portions of the script from a ticket scanner to figure out how to add more than one singular whitelisted tool for this. Below is the main script that runs the door function.
--[ VARIABLES ]--
local Players = game:GetService("Players")
local permission = { "Card" }
local RE = game:GetService("ReplicatedStorage")
local DoorRE = RE:WaitForChild("DoorRE")
local RDoor = script.Parent["UK Swing DoorR"].Model.Hinge
local LDoor = script.Parent["UK Swing DoorL"].Model.Hinge
local Sensor = script.Parent.Toucher
function checkOkToLetIn(name)
for i = 1,#permission do
if (string.upper(name) == string.upper(permission[i])) then return true end
end
return false
end
function onTouched(hit)
if hit.Parent:IsA("Model") and hit.Parent:FindFirstChild("Humanoid") then
print("Detection sensed")
local human = hit.Parent:findFirstChild("Humanoid")
local Player = Players:GetPlayerFromCharacter(hit.Parent)
local PlayerName = Player.Name
if (human ~= nil) then
print("Human touched door")
if (checkOkToLetIn(human.Parent.Name)) and script.Parent.Value.Value == true then
print("Player passed test")
script.Parent.Value.Value = false
wait(0)
for i = 1, 72 do
RDoor.CFrame = RDoor.CFrame * CFrame.new(0, 0, -0) * CFrame.fromEulerAnglesXYZ(0, -0.025, 0)
LDoor.CFrame = LDoor.CFrame * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0.025, 0)
wait(0.01)
end
wait(5)
for i = 1, 72 do
RDoor.CFrame = RDoor.CFrame * CFrame.new(0, 0, 0) * CFrame.fromEulerAnglesXYZ(0, 0.025, 0)
LDoor.CFrame = LDoor.CFrame * CFrame.new(0, 0, -0) * CFrame.fromEulerAnglesXYZ(0, -0.025, 0)
wait(0.01)
end
script.Parent.Value.Value = true
print("Test concluded")
end
else
print("Failed test")
workspace[Player.Name].Torso.CFrame = CFrame.new(script.Parent.TeleportDestination.Position)
DoorRE:FireClient(Player)
end
end
end
Sensor.Touched:connect(onTouched)
Notes
- The fired event at the bottom works perfectly and doesn't require change.
- I get a "HTTP 403 (Forbidden)" error when I try touch the door to run the script.
- If there is anything to optimise the script, that's fine.
Thanks in advance if anyone knows a fix to it.

2 comments
Have You Enabled HTTP in game Settings, By Chance?
Yes, I have enabled HTTP in the game's settings.