local Damage = script.Parent.Parent.Parent.Damage
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
human.Health = human.Health - Damage
end
end
script.Parent.Touched:connect(onTouched)
The main script just plays animations and turns on CanTouch for the damage part.
Probably some really easy fix but i aint too good.
local Tool = script.Parent
wait(1)
local Animation = Tool.Slash1
local Player = game.Players
local LocalPlayer = Player.LocalPlayer
local Char = LocalPlayer.Character
local Humanoid = Char:WaitForChild("Humanoid")
local AnimationTrack = Humanoid:LoadAnimation(Animation) --Animations, Important
local DmgPart = script.Parent.Handle.DmgPart
AnimationTrack.Priority = Enum.AnimationPriority.Action
Tool.Activated:Connect(function()
AnimationTrack:Play()
DmgPart.CanTouch = true
print("Playing")
wait(1)
DmgPart.CanTouch = false
end)
local Damage = script.Parent.Parent.Parent.Damage
function onTouched(hit)
if hit:IsA("BasePart") then
local human = hit.Parent:findFirstChild("Humanoid")
if (human ~= nil) then
human.Health = human.Health - Damage
end
end
end
script.Parent.Touched:connect(onTouched)
I made a gun script once, and added the kill script as a localscript and it was really confusing. Plus, that would defeat the whole purpose of using a localscript for the kill script instead.