How can I animate a character with a tool, then script it to work in-game?

The title is self explanatory, I know how to pretty much animate a tool by following this tutorial, however when it comes time to script it in-game, it doesn’t load or breaks. Is there any way to get it working? Thanks!

Context: I want to create an idle animation for a sword in blender, but I don’t know how to script the animation to work with the tool in-game.

EDIT: I was following this tutorial, but this mainly focuses on Roblox Studio.

3 Likes

Its not really the best to ask a developer to script a whole code for you but ima do it anyways. Heres the script (Dont forget to also make an animation thingy in the tool with the id inside

local Tool = nil
local animScript = nil
script.Parent.Equipped:Connect(function()
	Tool = script.Parent
	animScript = Tool.Parent:WaitForChild("Animate")
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "https://roblox.com/asset/?id=5346818551" -- insert idle animation here (just in case u don't know but u prob do to make an id from a blender animation export the animation to roblox then right click to save to roblox.
end)

script.Parent.Equipped:Connect(function()
	Tool = script.Parent
	animScript:WaitForChild("toolnone"):WaitForChild("ToolNoneAnim")
	animScript.toolnone.ToolNoneAnim.AnimationId = "https://roblox.com/asset/?id=5346818551" -- put the same id here
end)

If this worked please give me a green check!

2 Likes

Hi, thanks for your reply. I wasn’t asking for a script, I was asking how I would go about making one. I was speaking about making an animation in blender with a tool, then scripting it to work in roblox studio.

1 Like

Wdym? You make an animation by moving the joints differently per frame. and how to script it is you add a script to the tool. I rlly dont know what ur talking about please specify.

I mean like, say for example you want to be able to move the sword on its own, rather than just welding it to the character’s hand, then scripting that to work in-game, if that makes any sense.

1 Like

It would probably be easier to animate in studio, in my opinion.

To pull this off, your probably gonna have to create a custom tool, meaning inside of the tool properties, you should disable the RequiresHandle value. Then, your gonna have to

make a Client Script inside of the tool, that detects when the player equips the tool. Then once the player equips the tool, you will create a Motor6D inside of 'said arm. Part0 would be the arm and Part1 would be the “Handle”.

Then, to animate the tool, your gonna have to use TweenService on it. Where do you tween the Motor6d though? The C0 is what you are gonna tween. You can also add events inside of a key of the Animation Track, which when that event is reached, the tool will do this or do that.

To get when an key of an animation is reached, this should simply explain it:

AnimationTrack:GetMarkerReachedSignal(event)
     if event == "nameofevent" then
         -- do stuff with tool
         -- ex: local tween = ts:Create(motor6d, TweenInfo.new(0.5, -- Easing Style,  Easing Direction), {C0 = CFrame.new(0,5,0)})
         -- tween:Play()
     end
end)

This is all I got.

3 Likes

So you are saying move the weapon with the character or make an animation where the weapon moves without the character moving

3 Likes

You can add a humanoid rootpart to make the weapon move (might not need that for blender but thats how moon animator works)

2 Likes

Yeah I agree, with blender this may be near impossible, but roblox studio works. Thanks for you and @eeveelinknugget’s support!

4 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.