What do you want to achieve?
I am trying to make a system where whenever I have equipped my Tool i.e RoomKey then the door will open.
What is the issue?
The Issue is that when I open the door then it starts to behave very weirdly (like disappearing instantly) even though I have said to wait for 1 second before opening it.
local Debounce = false
game.Workspace.Door.Block.Touched:Connect(function(player)
if not Debounce then
local plr = player.Parent
local name = plr.Name
local our_main_target = plr:FindFirstChild("RoomKey")
if our_main_target then
Debounce = true
wait(1)
game.Workspace.Door.Block.Transparency = 1
game.Workspace.Door.Handle.Transparency = 1
game.Workspace.Door.Block.CanCollide = false
game.Workspace.Door.Handle.CanCollide = false
wait(5)
game.Workspace.Door.Block.Transparency = 0
game.Workspace.Door.Handle.Transparency = 0
game.Workspace.Door.Block.CanCollide = true
game.Workspace.Door.Handle.CanCollide = true
Debounce = false
end
end
end)