So, I’m developing my weapon system, and I’ve gotten to the step of animating the weapons using animations I’ve made via the MoonAnimator 2 plugin, and taking advantage of the tool’s Motor6D.
The problem I’m experiencing, is that once I use the animation in game (e.g., idle in onEquip), it turns out different from the animation I made. Viewing well then from the explorer, the Motor6D connected to the Tool’s Handle, and the Character’s Right Arm, did not move at all, when I in the animation I made changed the Handle’s position and direction.
I guessed that the problem is the Motor6D, and I tried to find some solution on the Forum or even from other sources outside of Roblox, but I cannot find a way to solve this problem.
Below is some media regarding the problem, and a piece of code regarding Motor6D:
What I expect:
What I get:
(If you should not notice any differences, the Handle that was animated does not move. In fact, the left arm should be near the weapon accessory, and not under the barrel)
Propety of Motor6D:
Local Script where I manage the Animations and the Motor6D:
local function onEquip(Child: Instance)
if Child:IsA("Tool") and Child:FindFirstChild("Handle") and Child:FindFirstChild("Animations") then
local Animator : Animator = Character:WaitForChild("Humanoid").Animator
CurrentTool = Child
local Animations = CurrentTool.Animations
local Handle = CurrentTool.Handle
print(Handle.Parent.Name)
Motor6D.Part0 = Character['Right Arm']
Motor6D.Part1 = Handle
AnimationTracks = {
["Idle"] = Animator:LoadAnimation(Animations.Idle),
["Reload"] = Animator:LoadAnimation(Animations.Reload),
["Equip"] = Animator:LoadAnimation(Animations.Equip),
["Shoot"] = Animator:LoadAnimation(Animations.Shoot)
}
if AnimationTracks then
AnimationTracks["Idle"].Priority = Enum.AnimationPriority.Action
AnimationTracks["Equip"].Priority = Enum.AnimationPriority.Action2
Handle.Sounds.Equip:Play()
AnimationTracks["Equip"]:Play()
AnimationTracks["Equip"].Stopped:Wait()
AnimationTracks["Idle"]:Play()
end
end
end
Server Script where I create the Motor6D
Server
local function createM6D(Character)
local rightArm = Character:FindFirstChild("Right Arm")
if not rightArm then
warn("Right Arm not found in character")
return
end
local existingHandle = rightArm:FindFirstChild("Handle")
if existingHandle then
existingHandle:Destroy()
end
local Motor6D = Instance.new("Motor6D")
Motor6D.Name = "Handle"
Motor6D.Parent = rightArm
if rightArm:FindFirstChildWhichIsA("Motor6D") then
Motor6D.C1 = CFrame.new(0, -0.200000048, 0.674999952, 1, 0, 0, 0, 0, -1, 0, 1, 0)
end
end
Players.PlayerAdded:Connect(function(Player: Player)
Player.CharacterAdded:Connect(function(Character)
--[[code stuff]]--
createM6D(Character)
--[[code stuff]]--
Player.CharacterAppearanceLoaded:Connect(function(Character)
createM6D(Character)
for _, Child in Character:GetChildren() do
if Child:IsA("Accessory") then
local Handle = Child:FindFirstChild("Handle")
if Handle then
Handle.CanQuery = false
end
end
end
end)
end)
I hope someone can answer me as soon as possible, and let me find a solution!