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.
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)
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.
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.
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)