When I preview a pre-rigged rig (Rigged while in studio) that has the gun already rigged to the character, it functions correctly (the gun successfully points despite the orientation of the right hand)
When I rig the gun to the right hand while in game, the gun seems to have all animations removed from it, with the arm only being animated.
(Note that the gun’s model is in a folder, not a seperate model, so it can easily attach itself. This is in both examples.)
This is the code I use to attach the Motor6D to the righthand and the gun.
local rs = game:GetService("ReplicatedStorage")
local gun = rs.Guns.Secondary:FindFirstChild("Glock")
local weld = script.Parent.Part
local animation = script.Parent.Hold
-- Variables are done.
script.Parent.Equipped:Connect(function(equip)
local guntoclone = gun:Clone()
local weldclone = weld:Clone()
local hum = script.Parent.Parent.Humanoid
local animator = hum.Animator
guntoclone.Parent = script.Parent.Parent
weldclone.Parent = script.Parent.Parent.RightHand -- Create the Motor6D.
weldclone.Part0 = script.Parent.Parent.RightHand -- Attach the Motor6D to the player's right hand.
weldclone.Part1 = guntoclone.Part -- Attach the "Root Part" of the the part of the Motor6D
local holdinganimation = animator:LoadAnimation(animation) -- Load the animation AFTER the gun is rigged to the player's right hand.
holdinganimation:Play(0.2) -- Play the animation while fading within 0.2 seconds.
end)
Help would be GREATLY appreciated.
I currently want the gun to be the same as the preview animation shown above (The gray character holding the weapon)