Ye uh my sword does not do any damage. I think its an issue with the idle animation…
Because whenever I do this to the idle animation (animation2) the damage works
--animation2.AnimationId = "rbxassetid://7172163432"
Script that doesn’t work:
local tool = script.Parent
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local InputService = game:GetService("UserInputService")
local InputType = Enum.UserInputType
local animation = nil
local slashAnimation = nil
local animation2 = nil
local Idle = nil
tool.Equipped:Connect(function()
animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://7162716543"
slashAnimation = humanoid:LoadAnimation(animation)
animation2 = Instance.new("Animation")
animation2.AnimationId = "rbxassetid://7172163432"
Idle = humanoid:LoadAnimation(animation2)
Idle.Looped = true
Idle:Play()
end)
tool.Unequipped:Connect(function()
animation:Destroy()
slashAnimation = nil
animation2:Destroy()
Idle:Stop()
Idle = nil
end)
local debounce = false
InputService.InputBegan:Connect(function(input, processed)
if input.UserInputType == InputType.MouseButton1 and slashAnimation and not processed then
if debounce == false then
debounce = true
slashAnimation:Play()
local Connection
local tool = script.Parent
local function onTouch(partOther)
local humanOther = partOther.Parent:FindFirstChild("Humanoid")
if not humanOther then return end
if humanOther.Parent == tool then return end
humanOther:TakeDamage(65)
if humanOther.Health <= 0 then
player.leaderstats.Souls.Value = player.leaderstats.Souls.Value + 1
humanOther.Parent:Destroy()
end
end
Connection = tool.Handle.Touched:Connect(onTouch)
slashAnimation.Stopped:Wait()
debounce = false
Connection:Disconnect()
wait(.2)
debounce = false
end
end
end)