ID door somehow not working

  1. What do you want to achieve? A door that only accepts certain IDs/keycards.

  2. What is the issue? It doesn’t let an allowed ID in, and allows invalid IDs in, and sometimes it just breaks like this:
    robloxapp-20201212-1827233.wmv (2.6 MB)

  3. What solutions have you tried so far? I suck at wording these problems so it’d just be better for me to make a new topic.

Here is the code:

TS = game:GetService("TweenService")
TP = TweenInfo.new(1)

script.Parent.ProximityPrompt.PromptButtonHoldBegan:Connect(function()
	script.Parent.Swipe:Play()
end)

script.Parent.ProximityPrompt.Triggered:Connect(function(player)
	for i,v in pairs (player:GetDescendants()) do
		if v.Name == 'ID' then
			if v.Value.Value == 'Owner' or 'Miner' or 'QA' or 'Transport' or 'Site Worker' or 'Visitor' then
				script.Parent.Valid:Play()
				local tween = TS:Create(script.Parent,TP, {Color = Color3.fromRGB(0, 255, 0)})
				tween:Play()
				wait(1)
				local tween = TS:Create(script.Parent,TP, {Transparency = 1})
				tween:Play()
				wait(1)
				script.Parent.CanCollide = false
				wait(5)
				script.Parent.CanCollide = true
				script.Parent.Color = Color3.fromRGB(255, 255, 255)
				local tween = TS:Create(script.Parent,TP, {Transparency = 0})
				tween:Play()
				wait(1)
				else if v.Value.Value ~= 'Visitor' or 'Miner' or 'QA' or 'Transport' or 'Site Worker' then
					script.Parent.Invalid:Play()
					local tween = TS:Create(script.Parent,TP, {Color = Color3.fromRGB(255, 0, 0)})
					tween:Play()
					wait(1)
					local tween = TS:Create(script.Parent,TP, {Color = Color3.fromRGB(255, 255, 255)})
					tween:Play()
					wait(1)
				end
			end
		end
	end
end)

What is meant to happen is for the IDs of Visitor, Miner, and Transport to work. The ID with the tooltip/value of ‘Site Noob’ should not work. Help is much appreciated!

Well for one you should probably add a debounce and assuming ‘Owner’ works and not the rest is because when you compare the or with just a string you’re not really comparing it to anything you should put all the allowed IDs in a table and see if you can find it in that table. i.e.
local ids = {‘Owner’,‘Miner’}
if table.find(ids,v.Value.Value} then

1 Like

Owner was something for me to check if the first value in that if statement wouldn’t work.

Still loops with the debounce added.
*Nevermind, it stopped after a bit.
**It was a mistake in my code.