So I'm making a game and you're supposed to get a knife to beat a boss. You get the knife by touching an invisible part. The thing is, it only works half the time. Sometimes it works, other times it doesn't. My knife is located in ServerStorage. Here's the code:
local db = true
script.Parent.Touched:Connect(function(hit)
db = false
if db == false then
wait(0.1)
local knife = game.ServerStorage:WaitForChild("Knife")
local knifer = knife:Clone()
knifer.Parent = hit.Parent
script.Parent:Destroy()
wait(1)
db = true
end
end)
Is there anything I'm doing wrong? It's making my mind explode right now, so please help.

5 comments
Why did you add a debounce?
Because it would give me multiple knives at once.
You just can't hit properly I am guessing hAhaHaHaHhhAahhaHAHhAhaHaHhahAhhahhAhaHaHahhAhaHaHaHhaH
never use wait() in a debounce.
unless you are toggling it only as the inverse.