Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I add an object to a script so I can use it in an animation?

Asked by 4 years ago

The vague title is probably confusing, but let me explain what I am saying. I am currently working on a musket for my civil war game. I got most of the reload animation done, but I need to add an object (paper cartridge to be specific) to this animation script which is from the vanguard gun kit. `` ReloadAnim = function(char, speed, objs) ts:Create(objs[2],TweenInfo.new(1),{C1 = CFrame.new(-0.230900264, -6.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08)}):Play() ts:Create(objs[3],TweenInfo.new(1),{C1 = CFrame.new(0.236954767, 0.654289246, -2.02817471, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043)}):Play() wait(1)

        local MagC = objs[4]:clone()
        MagC:FindFirstChild("Mag"):Destroy()
        MagC.Parent = objs[10]
        MagC.Name = "MagC"
        local MagCW = Instance.new("Motor6D")
        MagCW.Part0 = MagC
        MagCW.Part1 = objs[5]
        MagCW.Parent = MagC
        MagCW.C1 = MagC.CFrame:toObjectSpace(objs[4].CFrame)
        objs[4].Transparency = 1


        ts:Create(objs[3],TweenInfo.new(0.4),{C1 = CFrame.new(1.026954767, 2.654289246, -2.45337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043)}):Play()
        ts:Create(objs[2],TweenInfo.new(0.1),{C1 = CFrame.new(-0.230900264, -6.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08)}):Play()
        objs[6]:WaitForChild("MagOut"):Play()
        wait(0.5)
        ts:Create(objs[2],TweenInfo.new(0.3),{C1 = CFrame.new(-0.230900264, -6.317047596, -1.27966166, 0.985866964, -0.167529628, -7.32295247e-09, 0, -4.37113883e-08, 1, -0.167529613, -0.985867023, -4.30936176e-08)}):Play()
        wait(0.3)
        ts:Create(objs[3],TweenInfo.new(0.7),{C1 = CFrame.new(0.386954767, 1.054289246, -2.05337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043)}):Play()
        objs[6]:WaitForChild('MagIn'):Play()
        wait(1)
        ts:Create(objs[3],TweenInfo.new(0.4),{C1 = CFrame.new(1.026954767, 2.754289246, -2.65337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043)}):Play()
        wait(0.5)
        ts:Create(objs[3],TweenInfo.new(0.3),{C1 = CFrame.new(0.386954767, 1.154289246, -2.25337243, 0.894326091, -0.267454475, 0.358676374, -0.413143814, -0.185948789, 0.891479254, -0.171734676, -0.945458114, -0.276796043)}):Play()
        wait(0.4)
        MagC:Destroy()
        objs[4].Transparency = 0
    end;`` 

I know it has something to do with the "objs" thing in there. I know objs[3] is the left arm and objs[2] is the right arm. And I'm pretty sure objs[4] is the ramrod which I named "Mag". Can someone tell me how to add another object in there?

Answer this question