The sword does damage without being clicked? It does damage when it's touched not when it's clicked, I can't seem to find a way to fix this.
The Damage Script For My Weapon
Av = 15 --Attack Value tool = script.Parent function tagHumanoid(humanoid,killer) if humanoid and killer then local tag = Instance.new("ObjectValue") tag.Name = "creator" tag.Value = killer tag.Parent = humanoid end end script.Parent.Handle.blade.Touched:connect(function(p) local plr = game.Players:GetPlayerFromCharacter(tool.Parent) if script.Parent.CanDamage.Value == true and p.Parent:FindFirstChild("Humanoid") then script.Parent.CanDamage.Value = false local humanoid = p.Parent:FindFirstChild("Humanoid") humanoid:TakeDamage(Av) tagHumanoid(humanoid, plr) wait(1) script.Parent.CanDamage.Value = true if p.Parent.Humanoid.Health < 1 then print("Player Has Died") end end end)
I tried this
Av = 15 --Attack Value tool = script.Parent function tagHumanoid(humanoid,killer) if humanoid and killer then local tag = Instance.new("ObjectValue") tag.Name = "creator" tag.Value = killer tag.Parent = humanoid end end if script.Parent.Activated == true then script.Parent.Handle.blade.Touched:connect(function(p) local plr = game.Players:GetPlayerFromCharacter(tool.Parent) if script.Parent.CanDamage.Value == true and p.Parent:FindFirstChild("Humanoid") then script.Parent.CanDamage.Value = false local humanoid = p.Parent:FindFirstChild("Humanoid") humanoid:TakeDamage(Av) tagHumanoid(humanoid, plr) wait(1) script.Parent.CanDamage.Value = true if p.Parent.Humanoid.Health < 1 then print("Player Has Died") end end end) end
But now my weapon doesn't do damage?
Try using tool.Activated in your script. Activated means that it has been clicked. Hope this helps!