I'm using "enabled" instead of debounce. The problem here is that the weapons are spawning two or three at a time into the player's backpack. How do I fix this?
--Aceta
local venom = game.Lighting.Venomshank
local dark = game.Lighting.Darkheart
local katana = game.Lighting.BlueKatana
local sword = game.Lighting.Sword
local enabled = false
function onTouch(hit)
if hit.Parent and hit.Parent:FindFirstChild('Humanoid') and enabled == false then
enabled = true
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
local character = hit.Parent
character.Torso.CFrame = CFrame.new(Workspace.teleportation.Position+Vector3.new(math.random(1,10),math.random(1,10),math.random(1,10)))
local Sword = sword:Clone()
Sword.Parent = player.Backpack
if player.Venomshank.Value == true then
local Venom = venom:Clone()
Venom.Parent = player.Backpack
end
if player.Darkheart.Value == true then
local Dark = dark:Clone()
Dark.Parent = player.Backpack
end
if player.BlueKatana.Value == true then
local Katana = katana:Clone()
Katana.Parent = player.Backpack
end
enabled = false
end
end
script.Parent.Touched:connect(onTouch)

1 comment
How did you check for the tool?