How to animate an R6 Rig with an object

I am trying to make the user be able to throw a flag when they have one so i was making an animation using the flag to try to anticipate how it looks. Im fairly new to MoonAnimator and i was having trouble entering the part in the animator to animate\

video:

3 Likes

Is this flag being used as a tool or as the model itself?

Hello @Nifemiplayz,
The biggest issue here is the flag you try to use it is on a model. If you click on the model to animate it, it will not work. Yes, Moon Animator is peaky like that, but there is an easy way to fix it.

How to fix that?

    1. Go on the Easy weld icon inside of the plugin (It should be around the top right on the plugin);
      image
    1. Go select the Model area and go choose the right part to animate with. Click Weld Model when completed. (Look these pictures for an example);
      image
      image
    1. Go select the Parts area and go select the parts you wanted to use. ALWAYS the body part 1st and the part the 2nd. Click Join in place when completed. ;
      image
      image
    1. Open your Moon Animator display and add your dummy attached with the model selected.

And volia! You are good to go!

If you have any question, just dm me in Devforum. :wink:

Have a nice day,

3 Likes

It’s being used as a model. The flag will be on the players back and if they want to throw it they press F would it be better to make it a tool?

I welded the pole with the flag with motor6D I’m not able to test out your solution, would the weld I use work?

Yeah, it can be a tool if you want to detect if it’s equipped.

If it’s not you can code it so that it’ll weld onto the back of the player.

Else, if it is you can then user UserInputService to detect if “F” has been pressed and also to act out the throwing animation.

You can use @TuxedoDevelopment’s option to help sketch out how the throw would look and operate, but it’s not possible to animate the weapon’s throw animation with Moon Animator as of now… but we can use another solution to simulate the flag being thrown, it requires some coding.

The whole idea of animating with the tool to make sure it was a good throwing animation. What I am planning to do with the actual spear is add some velocity and heavy gravity to it(so when you throw it it curves down at some point) but I don’t know how I’ll do it yet

I was actually doing something like that not so long ago. If you like I could write in a template you could use to get yourself up, with comment notes on what the line(s) function is doing.

By the way, this does work with sketching it out. Like I said, if you want to really give it a throwing animation you’d have to use BodyVelocity Instances like you said.

Ok now that im at my computer Im going to use @TuxedoDevelopment Solution ill tell you how it goes

Oh lol i just forgot i did it without the model but imma see if i can make the throw mechanic actually work

Like I said above, I can make a template on how you would be able to do it if you like.

Oh yes i would appreciate that

UIS = game:GetService("UserInputService")

script.Parent.Equipped:Connect(function()

local Humanoid = script.Parent.Parent:FindFirstChild("Humanoid")
local Animation = script.Parent.Animation
local flagPole = script.Parent.Handle


if Humanoid and Humanoid.Health > 0 then

   local Animator = Humanoid:FindFirstChild("Animator") or Humanoid
   local PlayAnim = Animator:LoadAnimation(Animation)

   UIS.InputBegan:Connect(function(Input)

      if Input.KeyCode == Enum.KeyCode.F then
   
         PlayAnim:Play()
         wait(--[[This is actually where you put the frames in seconds of when the throw actually takes place.]])

            local bodyVelo = Instance.new("BodyVelocity")

            bodyVelo.MaxForce = (1,0,1) * 30000
            bodyVelo.Velocty = flagPole.UpVector * -100 -- I don't know how exactly the animation would look like, but I'm assuming it would be thrown as a spear would. You can change this around if you like.

            wait(0.4)
            bodyPos:Destroy()
         end
      end
   end)
end)

I didn’t script it where it automatically get’s taken out of the players hand, but you could look on DevForum to see if you could do that. If there isn’t, let me know.

Players.Nifemiplayz.Backpack.RedFlagtest.Mechanics:24: attempt to call a table value
I got that error from this line:
bodyVelo.MaxForce = Vector3(1,0,1) * 30000

I thought you forgot the Vector3 because it was giving me syntax errors so i added it

1 Like

Oh I forgot to add Vector3.new, my fault.

1 Like

Change it from Vector3, to Vector3.new.

1 Like

Thank you, I did actually forget to add this part. Of course without it it wouldn’t be able to read it since it’s expecting a Vector3

1 Like

UpVector is not a valid member of Part “Workspace.Nifemiplayz.RedFlagtest.Handle”
Error from this line:
bodyVelo.Velocty = flagPole.UpVector * -150

After flagPole, put CFrame. since it’s actually apart of that library.