The issues are:
- The right hand for some reason instantly attaches itself to the tool instead of following the animation
- If unequipped during unequip animation, the unequip animation doesn’t stop as it is supposed to
- Legs do not move during idle
I made these animations in blender so i can practice how to animate in blender, here is a video showcasing all of the problems
Here is the code that handles the motor6d.
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local HRP = Character:WaitForChild("HumanoidRootPart")
local Animator = Character:WaitForChild("Humanoid").Animator
local RightHand = Character:FindFirstChild("RightHand")
local EquipAnimation = script.Parent.Equip
local idleAnimation = script.Parent.Idle
--Animations --
local EquipTrack = Animator:LoadAnimation(EquipAnimation)
local IdleTrack = Animator:LoadAnimation(idleAnimation)
script.Parent.Equipped:Connect(function()
-- Remove any existing Motor6D with the same name to avoid conflicts
if HRP:FindFirstChild("RightGrip") then
HRP:FindFirstChild("RightGrip"):Destroy()
end
-- Create and configure the Motor6D
local m6d = Instance.new("Motor6D")
m6d.Name = "RightGrip"
m6d.Part0 = HRP
m6d.Part1 = script.Parent.Handle
-- Adjust CFrame values to match Blender setup (tweak as needed)
m6d.C0 = CFrame.new(1.566, -1.174, -0.084) * CFrame.Angles(0, math.rad(-90),0)
m6d.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0)
-- Parent the Motor6D to the HumanoidRootPart
m6d.Parent = HRP
-- Play the animation
EquipTrack.Priority = Enum.AnimationPriority.Action2
EquipTrack:Play()
EquipTrack.Stopped:Wait()
IdleTrack:Play()
end)
script.Parent.Unequipped:Connect(function()
if EquipTrack.IsPlaying then
EquipTrack:Stop()
elseif IdleTrack.IsPlaying then
IdleTrack:Stop()
end
end)