Problem
Alright, so lately I’ve been making a game using animations and motor6ds to rig and animate weapons. I animated the weapon successfully, but when I rig it in a script it appears strangely.
The idle animation is meant to look like this:
But instead it looks like this:
How do I fix this so the weapon is in the correct position? I’ve already done all the animations I’ve had to, and I hope I don’t need to restart 4 hours of work just for a studio bug.
Code
--//VARIABLES\\--
--|SERVICES|--
local storage = game:GetService("ServerStorage")
local players = game:GetService("Players")
local replicated = game:GetService("ReplicatedStorage")
--|FOLDERS|--
local weapons = storage:WaitForChild("Weapons")
local animations = storage:WaitForChild("Animations")
--|DIRECTORIES|--
local sekiroweapons = weapons:WaitForChild("Sekiro")
local sekiroanims = animations:WaitForChild("Sekiro")
--//MODULE\\--
players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(char)
--//VARIABLES\\--
--|BODY|--
local root = char:WaitForChild("HumanoidRootPart")
local torso = char:WaitForChild("Torso")
local rarm = char:WaitForChild("Right Arm")
--|WEAPONS|--
local katana = sekiroweapons:WaitForChild("Katana")
--|SCRIPTS|--
local animate = char:WaitForChild("Animate")
--|POSES|--
local run = animate:WaitForChild("run"):WaitForChild("RunAnim")
local walk = animate:WaitForChild("walk"):WaitForChild("WalkAnim")
local idle1 = animate:WaitForChild("idle"):WaitForChild("Animation1")
local idle2 = animate:WaitForChild("idle"):WaitForChild("Animation2")
local jump = animate:WaitForChild("jump"):WaitForChild("JumpAnim")
local fall = animate:WaitForChild("fall"):WaitForChild("FallAnim")
--//MODULE\\--
local weapon = katana:Clone()
weapon.Parent = char
local motor = Instance.new("Motor6D")
motor.Parent = rarm
motor.Name = "Weapon"
motor.Part0 = rarm
motor.Part1 = weapon:WaitForChild("Frame")
run.AnimationId = sekiroanims:WaitForChild("Walk").AnimationId
walk.AnimationId = sekiroanims:WaitForChild("Walk").AnimationId
idle1.AnimationId = sekiroanims:WaitForChild("Idle").AnimationId
idle2.AnimationId = sekiroanims:WaitForChild("Idle").AnimationId
end)
end)
--try rearranging you code where the motor is to this:
--make these lines:
local motor = Instance.new("Motor6D")
motor.Parent = rarm
motor.Name = "Weapon"
motor.Part0 = rarm
motor.Part1 = weapon:WaitForChild("Frame")
--this
local motor = Instance.new("Motor6D")
motor.Name = "Weapon"
motor.Part0 = rarm
motor.Part1 = weapon:WaitForChild("Frame")
motor.Parent = rarm
I manually added a motor6d into the right arm of the dummy, connecting it to the frame; the main part of the weapon. Isn’t this the exact same thing I did with the script?
This is because the Motor6Ds in dummies are not default Motor6Ds, they have C0 and C1 properties that you cannot view in the properties panel. You can make a brand new Motor6D when rigging the dummy (Instance.new("Motor6D", workspace) in console) or you can copy the Motor6D you use directly from the dummy via the script. I personally do the second option, however it’s up to you.
Check the animation priority. It’s set to ‘Core’ by default, and if you haven’t changed it then the default idle animation will layer on top of it weirdly.
Yes, you’re right. @Stealthied Did you create a new Motor when animating the Dummy? Or just copy and pasted an existing one inside the Dummy such as Left Shoulder? Since it works when you copy and paste the Motor6D inside the dummy but not by creating a new one. as fireboltofdeath said, the Motor6Ds inside the dummy (Left Shoulder, Right Shoulder etc.) have a different C0 and C1, they can both result your tool offsetting from your arm.
I think I copied an existing one from inside the dummy and changed its properties from what I remember. Well, it may be a choppy method to use a cloned version of a dummy’s motor6d but it definitely works 100 times better than creating a new one, and is easier.