I made this cafe and there is a door that only allows certain people in, when I went to test it out, it never worked. Here is the code
--Made by Gangnumstylefan local sp=script.Parent function onTouched(hit) h = hit.Parent.Name if game.Players.LocalPlayer.Name =="gangnumstylefan" or "Khyrax" or "Player1" then sp.CanCollide = false wait(3) sp.CanCollide = true end end script.Parent.Touched:connect(onTouched)
access ={"gangnumstylefan", "Khyrax", "Player1"} function debounce(func) local isRunning = false -- Create a local debounce variable return function(...) -- Return a new function if not isRunning then isRunning = true func(...) -- Call it with the original arguments isRunning = false end end end script.Parent.Touched:connect(debounce(function(hit) if hit.Parent and game.Players:GetPlayerFromCharacter(hit.Parent) then p = game.Players:GetPlayerFromCharacter(hit.Parent) for i,v in pairs(access) do if p.Name:lower() == v:lower() then script.Parent.Transparency = 0.7 script.Parent.CanCollide = false wait(0.5) script.Parent.Transparency = 0 script.Parent.CanCollide = true end end end end))
~ Thank me by accepting this answer/bumping up my reputation!