Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make sword that does damage when its clicked and hit player?

Asked by 2 years ago
Edited 2 years ago

Hi, I am here to make a sword that when is clicked and hit the player it will do damage, and if it isn't clicked/hit the player it doesn't do any damage, when I try my script, after I click and get close to the player it does damage continuously, how do I fix it

Here is my script

local Knife = script.Parent:FindFirstChild("Handle")
local Tool = script.Parent
Tool.Activated:Connect(function(attack)
    Knife.Touched:Connect(function(hit)
        local Humanoid = hit.Parent:FindFirstChild("Humanoid")
        Humanoid.Health = Humanoid.Health - 1
    end)
end)

Answer this question