I want to animate the tool and I used a motor6d but instead of staying where it is in the animation, it keeps jittering around
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild('Humanoid')
local tool = script.Parent
local equipAnimTrack = humanoid:LoadAnimation(script.Parent.equip)
local swing1 = humanoid:LoadAnimation(script.Parent['1'])
local swing2 = humanoid:LoadAnimation(script.Parent['2'])
local swing3 = humanoid:LoadAnimation(script.Parent['3'])
local motor6d
local combo = 0
local cooldown = false
local cooldownTime = .69
tool.Equipped:Connect(function()
local a = character:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
motor6d = Instance.new("Motor6D")
motor6d.Parent = character:FindFirstChild("Right Arm")
motor6d.Name = 'RightGrip'
motor6d.Part0 = a.Part0
motor6d.Part1 = tool.Handle
motor6d.C0 = a.C0
motor6d.C1 = a.C1
a:Destroy()
equipAnimTrack:Play()
end)
tool.Unequipped:Connect(function()
motor6d:Destroy()
for _, anim in pairs(player.Character.Humanoid:GetPlayingAnimationTracks()) do -- stops all anims
anim:Stop()
end
end)
tool.Activated:Connect(function()
if combo == 0 and cooldown == false then
cooldown = true
swing1:Play()
combo = combo + 1
wait(cooldownTime)
cooldown = false
elseif combo == 1 and cooldown == false then
cooldown = true
swing2:Play()
combo = combo + 1
wait(cooldownTime)
cooldown = false
elseif combo == 2 and cooldown == false then
cooldown = true
swing3:Play()
wait(cooldownTime)
cooldown = false
combo = 0
end
end)
Its supposed to look like this
External MediaIt looks like this
External Media