So I made an owner only door that only opens if I (represented by my UserID) walks through it (and also if someone else i know walks through it they explode). It works fine, but for some reason it only works once. I'm not sure if I'm just not waiting long enough for the door to start back at the beginning, but yeah it only works once. What's did I do wrong? (I just want it able so that the door cant be spammed by using a debounce.)
debounce = false
script.parent.Touched:connect(function(hit)
if debounce == true then return end
debounce = true
if hit.Parent:FindFirstChildOfClass("Humanoid") then -- Checks if it has a humanoid
local plr = game.Players:GetPlayerFromCharacter(hit.Parent) -- Gets the player associated with the character
if plr then -- Make sures it is actually there
if plr.UserId == 34310670 then -- Makes sure it has the correct userid
local m = Instance.new("Message",game.Workspace)
m.Text = 'LilC has entered the safe house'
wait(3)
m:Destroy()
script.Parent.Transparency = .5
script.Parent.CanCollide = false
wait(3)
script.Parent.Transparency = 0
script.Parent.CanCollide = true
elseif plr.UserId == 28066664 then
plr.Character:MoveTo(Vector3.new(21, 66.9, -96.5))
local bomb = Instance.new("Explosion",game.Workspace)
bomb.Position = plr.Character.Torso.Position
end
end
end
end)

3 comments
God, this is such good tabbing. Upvote just for that +1
Well at the end of the script, just add Debounce = false.
Thanks for the help