I am trying to make a gun, so whenever the gun is equipped it plays an animation.
local Gun = script.Parent
local Player = Gun.Parent.Parent
local Char = Player.Character
Gun.Equipped:Connect(function()
print("Equipped gun!")
local Motor6d = Instance.new("Motor6D", Char.RightHand)
Motor6d.Name = "GunMotor6d"
Motor6d.Part0 = Char.RightHand
Motor6d.Part1 = Gun.Handle
AnimTrack = Char.Humanoid:LoadAnimation(Gun.Aim)
AnimTrack:Play()
end)
Gun.Unequipped:Connect(function()
print("UnEquipped gun!")
if Char.RightHand:FindFirstChild("GunMotor6d") then
Char.RightHand.GunMotor6d:Destroy()
end
AnimTrack:Stop()
end)
The problem is that when the animation ends, the character goes back to the idle pose instead of staying in the position it ended. If you know how to fix this, please let me know. Thanks in advance.

3 comments
It dosen't work :(
I am trying to do it like this - https://www.youtube.com/watch?v=99FymB2b9t4
Message me on discord @ Brandon#4128. What I've said does work. I did this for one of my games.