I’ve been trying to find out how to add a tool/object to a npc and animate it but I can never find a way to do it.ive tried welding it to the npc’s hand but no luck ive also tried find a way to script it but it never works.any ways you guys know how to do this.p.s I’m not a good scripter.
What I would do in this case is use the Character Creator plugin and then use it weld the “Handle” of the tool to the players arm. You would then be able to animate the tool in the NPCs hand.
You can create a Motor6 connecting the tool to the NPC’s hand using the plugin that @Zombiefin stated.
Just ensure that the parts in the tool is welded to the handle so it moves with the handle.
I will try my best with this suggestions thanks
You can equip tools on a humanoid using EquipTool.
Example:
Humanoid:EquipTool(script.Tool)
(The Tool is in the script)
To give anyone that replies a example I would try to make a npc/rig pick up water from a pond with a bucket but I can’t figure out how to animate the npc/rig with the bucket.
@H_mzah actually made a tutorial which will be useful for you to read:
How to animate a tool/object with a Dummy in the Animation Editor
I’m sure if you grasp the concepts here, you can apply it to an NPC.
Ok I’ll look through it.hope your right
-- weld script
local tool = script.Parent
local primary = tool:WaitForChild("Handle")
for _,v in pairs(tool:GetChildren()) do -- loop that iterates through the tool
if v.Name ~= "Handle" and v:IsA("BasePart") then -- checking if it's a part and isn't named handle
local weld = Instance.new("Weld") -- creating glue or whatever it is
weld.Part0 = v -- setting attachment1 of the weld to 'v' which is the part
weld.Part1 = primary -- setting attachment2 of the weld to the primary tool which is 'Handle'
weld.Parent = primary -- placing the weld inside of the primary
end -- ending the if statement that checks if it's a part etc
end -- ending the iteration (will still restart to the beginning until it welds all parts)
Idk if I missed anything but this is how you weld a tool (You may need to add anchoring and unanchoring after everythings welded).
I will ask where would the script go exactly and would I have to weld a object to the hand and put the script in the npc or ?
To attach the object to the hand you simply just name it ‘Handle’. Then when you equip the tool it will magically attach to your hand. You have to change the toolgrip if you don’t like the way it looks though. (tool properties)
Also the script goes inside of the tool
This would allow me to animate the tool with the npc yes?
To animate your tool you need to create an animationtrack. But If by animating you mean your hand goes up and you have the tool then yes that is what will happen.
For animating check this out; Animation | Documentation - Roblox Creator Hub
Thanks for the help I figured it out
No problem! Also fyi there’s a weld plugin you can use to weld tools anyways you don’t need a script.
Plugin; https://www.roblox.com/library/148570182/Weld-Plugin