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\
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?
Go on the Easy weld icon inside of the plugin (It should be around the top right on the plugin);
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);
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. ;
Open your Moon Animator display and add your dummy attached with the model selected.
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.
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
UpVector is not a valid member of Part “Workspace.Nifemiplayz.RedFlagtest.Handle”
Error from this line:
bodyVelo.Velocty = flagPole.UpVector * -150