function Equip(weapon)
if debounce == true then
debounce = false
if Character then
if WeaponRequest:InvokeServer(weapon) == 1 then
for _, v in pairs(Character:GetChildren()) do
if v:IsA("Tool") then
if v.Name ~= weapon then
v:Destroy()
for t, u in pairs(player.Backpack:GetChildren()) do
if u.Name == weapon then
print("d")
local yy = u:Clone()
yy.Parent = Character
end
end
refreshUI(weapon)
else
v:Destroy()
refreshUI("niente")
end
else
for t, u in pairs(player.Backpack:GetChildren()) do
if u.Name == weapon then
local yy = u:Clone()
yy.Parent = Character
end
end
refreshUI(weapon)
end
end
end
debounce = true
end
end
end
If i try to run this function, i clone the weapon 33 times inside the Character, and not only 1. How i can fix?

1 comment
Where do you want to stop the loop?