Not sure what's going on here but it could just be me being dumb, my debounce isn't working. other than that everything is working fine
is it because of how I placed the debounce?
game.Players.PlayerAdded:Connect(function(player) script.Parent.Touched:Connect(function(hit) local char = hit.Parent local hum = char:FindFirstChild("Humanoid") local debounce = false if hum and not debounce then local players = game:GetService("Players") local player = players:GetPlayerFromCharacter(char) local pack = player.Backpack local findSword = pack:FindFirstChild(player.Name.."'s sword") local char = player.Character or player.CharacterAdded:Wait() local equippedSword = char:FindFirstChild(player.Name.."'s sword") if not findSword and not equippedSword then local SwordE = player:WaitForChild("EquippedSword") if SwordE then local Swordbank = game.ReplicatedStorage:WaitForChild("SWORDBANK") for _,Bank in pairs(Swordbank:GetChildren()) do if Bank:IsA("Tool") then if Bank.Name == SwordE.Value then local CloneBank = Bank:Clone() CloneBank.Name = (player.Name.."'s sword") CloneBank.Parent = char debounce = true wait(5) debounce = false end end end end end end end) end)
Yes, it IS because of how the debounce is placed. debounce
is always set to false when the event fires. You need to declare the variable outside the events.