Sitting Animation with Prop in Hand

So basically, I’ve been trying to create an animation with a prop in hand (not a tool) that is triggered by a seat. The issue I’m running into is that I don’t know how to rotate the sword prop or position it correctly for the animation. I can’t tell if I’m going about this the right way either, so any suggestions will help!

For an in-depth explanation of what I have so far,
To start: I created an animation within Moon Animator & the prop together (this is the animation I’m using for reference);

Then I created the following script & put it into the seat, so that when the animation is activated it spawns in the sword prop, creates a Motor6D to assign the sword prop to the CFrame of the right hand:

local seat = script.Parent
local sword = workspace.TestingSword
local currentAnim = nil
local clonedSword = nil

function CreateWeld(From,To)
    if not (From and To) then return end
    if not To:IsA("BasePart") then return end
    local Weld = Instance.new("Motor6D") Weld.Part0 = From Weld.Part1 = To
    Weld.C0 = From.CFrame:inverse() * From.CFrame
    Weld.C1 = To.CFrame:inverse() * From.CFrame
    Weld.Parent = To return Weld
end

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local Humanoid = seat.Occupant
    if Humanoid then --Enables the animation
        clonedSword = sword:Clone()
        clonedSword.Name = "ClonedSword"
        clonedSword.CFrame = Humanoid.Parent.RightHand.CFrame
        clonedSword.Parent = Humanoid.Parent
        
        CreateWeld(Humanoid.Parent.RightHand,clonedSword)
        currentAnim = Humanoid:LoadAnimation(seat.sitanim) 
        currentAnim:Play()
    else --Disables the animation
        clonedSword:Destroy()
        currentAnim:Stop() 
        currentAnim:Destroy() 
    end
end)

Which as a result, plays out like this

I got the blade to be attached, but it’s not in it’s correct orientation (the same position as seen within the animator) - any idea what I could be doing wrong?
Any help is appreciated! Thanks!

1 Like

If I need to add any details lmk, I’m still looking into this issue myself and can’t seem to find a resolve.

I know its been about a month since you contacted me, and I am sorry to say I haven’t been scripting or building in a long time, but I may have some small clue. It looks like you ended up welding the blade to the hand, and the motor6d sort of does that for you from what I recall. The weld may be stopping the Motor6d from moving the sword in the way the animation shows, and keeping the object in its current place. If you look into the player character, you can see that everything stays together due to mot6d’s and not welds, so welding things likely caused the blade to orientate itself to the Cframe in the instance it was created, but then cannot move in time with the animation due to the fact that it is welded in place. I am sorry I responded so late, I haven’t been on the dev scene in quite some time, and I rarely check my email, but I hope this helps.