Weapon animation stopping before its complete

not getting any errors, everything else is working besides the animation. tried to speed up/ slow down the animation, change cooldown time, I made the weapon today and its only happening to this weapon.

Script:

local TS = game:GetService("TweenService")
local tool = script.Parent
local Handle = tool:WaitForChild("Weapon")

local CanDmg = false
local debounce = true
local damage = 65
local cd = .46
local TouchEnabled = false
local Trail = tool.Weapon.Trail
local combo = 0
tool.Equipped:Connect(function()
	local char = tool.Parent
	local M6D = Instance.new("Motor6D", script)
	M6D.Name = "ToolGrip"
	M6D.Part1 = tool.BodyAttach
	M6D.Part0 = char:WaitForChild("Right Arm")
	M6D.C0 = CFrame.new(0,0,0)
	Trail.Enabled = true
	task.wait(.26)
	Trail.Enabled = false

end)
tool.Unequipped:Connect(function()
	local M6D = script.ToolGrip
	M6D:Destroy()
	combo = 0
end)




local function slash()
	if not debounce then
		return
	end
	


	debounce = false
	TouchEnabled = true
	Trail.Enabled = true
	CanDmg = true
	Handle.Swing:Play()
	
	if combo == 0 then
		wait(.41)
		combo = 1
	elseif combo == 1 then
		wait(.41)
		combo = 2
	elseif combo == 2 then
		wait(.41)
		combo = 0
	end
	CanDmg = false
	Trail.Enabled = false
	task.wait(cd)
	debounce = true
	TouchEnabled = false
end

local function onTouch(Touch)
	if not TouchEnabled then return end
	
	local playerTorso = tool.Parent.Torso
	
	local Humanoid = Touch.Parent:FindFirstChild("Humanoid")
	if Humanoid == nil or not CanDmg then
		return
	end
	Humanoid:TakeDamage(damage)
	CanDmg = false

	Handle.Hit:Play()
	Handle.Growl1:Play()

	if Humanoid.Health <= 0 then
		Humanoid.died:Connect(function()
			local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
			if plr then
				plr.leaderstats.Kills.Value += 1
				local sound = Instance.new("Sound")
				sound.SoundId = "rbxassetid://1333149768"
				sound.Parent = Humanoid.parent.Head
				sound.PlaybackSpeed = 1
				sound:Play()

			end

		end)
	end
	
	
	local Pow  = script.Pow:clone()
	Pow.Parent = Humanoid.Torso
	Pow:Emit(1, 1)
	
	
	local Highlight = Instance.new("Highlight")
	Highlight.Parent = Touch.Parent
	Highlight.DepthMode = Enum.HighlightDepthMode.Occluded
	Highlight.FillColor = Color3.fromRGB(195, 0, 0)
	Highlight.FillTransparency = 0
	Highlight.OutlineTransparency = 1
	game:GetService("TweenService"):Create(Highlight, TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, true), {FillTransparency = 1}):Play()
	game.Debris:AddItem(Highlight, 1)
	
	
	
	local BV = Instance.new("BodyVelocity")
	BV.MaxForce = Vector3.new(100000 / 2,1000,100000 / 2)
	BV.Velocity = playerTorso.CFrame.LookVector * 16
	BV.Parent = Humanoid.Torso
	task.wait(0.12)
	BV:Destroy()
end

tool.Activated:Connect(slash)
Handle.Touched:Connect(onTouch)

LocalScript:

local parent = script.Parent
local Handle = parent:WaitForChild("Weapon")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local TweenService = game:GetService("TweenService")
local Camera = workspace.CurrentCamera

local Humanoid = character:WaitForChild("Humanoid")

IdleAnim = parent.Animations.Idle
EquipAnim = parent.Animations.Equip
Attack = parent.Animations.Attack
AttackC2 = parent.Animations["Attack C2"]
AttackC3 = parent.Animations["Attack C3"]

local Equip = Humanoid:WaitForChild("Animator"):LoadAnimation(EquipAnim)
local Idle = Humanoid:WaitForChild("Animator"):LoadAnimation(IdleAnim)
local Attack = Humanoid:WaitForChild("Animator"):LoadAnimation(Attack)
local AttackC2 = Humanoid:WaitForChild("Animator"):LoadAnimation(AttackC2)
local AttackC3 = Humanoid:WaitForChild("Animator"):LoadAnimation(AttackC3)


CanDmg = false
Can = true
cd = .46
combo = 0
isToolEquipped = false

parent.Unequipped:Connect(function()
	isToolEquipped = false
	Unequip()
	local M6D = script.Parent.Script.ToolGrip
	M6D:Destroy()
	combo = 0
end)

function Unequip()
	local M6D = script.ToolGrip
	M6D:Destroy()
	Equip:Stop()
	Idle:Stop()
	Attack:Stop()
	
end

parent.Equipped:Connect(function()
	local char = parent.Parent
	local M6D = Instance.new("Motor6D", script)
	M6D.Name = "ToolGrip"
	M6D.Part1 = parent.BodyAttach
	M6D.Part0 = char:WaitForChild("Right Arm")
	M6D.C0 = CFrame.new(0,0,0)
	
	isToolEquipped = true
	Equip:Play()
	Handle.Equip:Play()
	task.wait(.26)
	if isToolEquipped == true then
		Idle:Play()
	end
	
end)

parent.Activated:Connect(function()
	if Can == true then
		
		if combo == 0 then
			Can = false
			if Idle.IsPlaying then
				Idle:Stop()
			end
			if isToolEquipped == true then
				print("true")
				Attack:Play()
			end
			wait(.41)
			if isToolEquipped == true then
				Idle:Play()
			end
			wait(cd)
			combo = 1
			Can = true
		elseif combo == 1 then
			Can = false
			if Idle.IsPlaying then
				Idle:Stop()
			end
			if isToolEquipped == true then
				print("true")
				AttackC2:Play()
			end
			wait(.41)
			if isToolEquipped == true then
				Idle:Play()
			end
			wait(cd)
			combo = 2
			Can = true
		elseif combo == 2 then
			Can = false
			if Idle.IsPlaying then
				Idle:Stop()
			end
			if isToolEquipped == true then
				print("true")
				AttackC3:Play()
			end
			wait(.41)
			if isToolEquipped == true then
				Idle:Play()
			end
			wait(cd)
			combo = 0
			Can = true
		end	
	end

end)


1 Like