Hey, I'm new. Most of my code is from other people, and I'm not very knowledgeable. I have tried many things so far, and this is the current state of my code:
local tool = script.Parent
local canDamage = false
local Animation2 = Instance.new("Animation4")
Animation.AnimationId = "rbxassetid://9119859474"
local function onTouch(otherPart)
local humanoid = otherPart.Parent:FindFirstChild("Humanoid")
if not humanoid then
return
end
if humanoid.Parent ~= tool.Parent and canDamage then
humanoid:TakeDamage(5)
else
return
end
canDamage = false
end
local function slash()
local Character = tool.Parent
local Humanoid = Character.Humanoid
local AnimationTrack = Humanoid:LoadAnimation(Animation2)
AnimationTrack:Play()
CanDamage = true
end
tool.Activated:Connect(slash)
tool.Handle.Touched:Connect(onTouch)
The script is in starterpack, and is in a tool named bonky with the body and the animation, a keyframe sequence, which I'm not entirely sure is a correct format but could not get it into any other format. I have been frustrated for a long time, would appreciate comprehensive answers.
