So I have a button that gives the user a gun than destroys the one they have in there inventory but if you click the button again within a few seconds the gun will be destroyed and nothing will be in its place. I tried adding a wait but that did nothing, here is the code
local button = script.Parent
local plr = game:GetService('Players').LocalPlayer
local tool = game.ReplicatedStorage.ACS_Engine.HOOD["Micro UZI"]
button.Activated:Connect(function()
script.Parent.Parent.Visible = false
plr.Backpack:FindFirstChildWhichIsA('Tool'):Destroy()
local clone = tool
clone.Parent = plr.Backpack
wait(0.5)
script.Parent.Parent.Parent.ClassH.Visible = true
wait(3)
script.Parent.Parent.Parent.ClassH.Visible = false
end)
Thanks!

2 comments
He's trying to clone the tool. This did not help...
thanks for the answer vileras look at the comments that I put on tightanfalls answer(Im to lazy to write them again)