Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can you animate a tool using roblox animations ?

Like if you just wanted to move the handle of a tool instead of it being stuck to just wherever the toolgrip is.

1 answer

✓ Accepted answer
How I animate a tool is by copying a handle of a tool into the player and welding the handle to play player's hand with Motor6D by scripting, because Motor6D is how your player is connected and animated.

I would use this script, but it's for animating an NPC. Anchor the HumanoidRootPart and arrange the tool on how you want it to connect to the right arm or other body parts. The script goes into the NPC. Run the game and copy the NPC then stop the game and remove the script so it won't have two of the same connection.

local mo = Instance.new("Motor6D")
mo.Part0 = script.Parent["Right Arm"]
mo.Part1 = script.Parent.Wep -- Name of Tool Handle
mo.C1 = script.Parent.Wep.CFrame:inverse() * script.Parent["Right Arm"].CFrame
mo.Parent = script.Parent["Right Arm"]

print(mo.C1) -- For connecting the player

If you want a player to have the weapon then do this. Make sure this is a local script inside the starterpack.

wait()
local character = game.Players.LocalPlayer.Character
local tool = game.ReplicatedStorage["Weapon"]:Clone() -- tool handle
tool.Parent = character 

local mo = Instance.new("Motor6D")
mo.Part0 = character["Right Arm"]
mo.Part1 = tool
mo.C1 = CFrame.new() -- Put here the printed CFrame
mo.Parent = character["Right Arm"]

3 comments

0

Could I ask how do you weld using Motor6D ?

0

I didn't test this, but it this is how I make my games.

0

Thanks !

This discussion is preserved as it was. New answers, comments, and votes are closed.