I’ve got a hammer ingame and it plays an animation when activated, this animations includes the handle, I made a joint in the animation rig and added the handle, uploaded the animation and stuff
Problem is the tool isn’t animating INGAME, the handle doesn’t move
(I somewhat solved this but there is still an issue, look at “EDIT 2” down below)
Proof:
– // Ingame
– // In animation editor
Then I have this ServerScript inside the tool that makes a Motor6D when equipped
local tool = script.Parent
local plr = tool.Parent.Parent
local char = plr.Character or plr.CharacterAdded:Wait()
tool.Equipped:Connect(function()
local M6D = Instance.new("Motor6D")
M6D.Name = "Tool"
M6D.Part0 = char:FindFirstChild("RightHand") or char:FindFirstChild("Right Arm")
M6D.Part1 = tool.Handle
M6D.Parent = char:FindFirstChild("RightHand") or char:FindFirstChild("Right Arm")
end)
tool.Unequipped:Connect(function()
local arm = char:FindFirstChild("RightHand") or char:FindFirstChild("Right Arm")
arm:FindFirstChild("Tool"):Destroy()
end)
and a LocalScript that plays the animation
I know the animations look the same, but in the animation editor the hammer is tilted slightly. I can tell by the angle that it isn’t playing ingame.
Sorry if it’s a long topic I needed to explain myself HELP
(Edit: tried using moon animator yet I couldn’t get it to work)
EDIT 2:
Seems like the reason my tool wasn’t animating is because the Motor6D was not activated when created because there was already a weld from the RightHand to the Handle, which is the default RightGrip weld Roblox makes for tools
Deleting this weld and replacing it with my own Motor6D did somewhat work but not perfectly
Now the animation doesn’t play properly
I couldn’t find anything of use in that doc, I want the tool (hammer) to be a part of the playing animation, If i wanted to make float in the animation, I need to add the tool, to the animation.
Hm weird, try setting it to Action 4. If that’s still not working maybe double check the m6d was parented to the correct spots on the player model. it should be the same setup as the one you have in the animator
Well, code-wise, it’s great. I added checks to ensure required parts exist, preventing errors if, for example, “RightHand” or “Right Arm” is not found in the character. You could also initialize variables for the player and the character and work with them once you have the tool equipped.
local playersService = game:GetService('Players')
local tool = script:FindFirstAncestorWhichIsA('Tool')
local player, character
tool.Equipped:Connect(function()
character = tool.Parent
player = playersService:GetPlayerFromCharacter(character)
local rightHandOrArm = character:FindFirstChild("RightHand") or character:FindFirstChild("Right Arm")
if character and rightHandOrArm then
local motor6d = Instance.new("Motor6D")
motor6d.Name = "Tool"
motor6d.Part0 = rightHandOrArm
motor6d.Part1 = tool.Handle
motor6d.Parent = rightHandOrArm
end
end)
tool.Unequipped:Connect(function()
if typeof(character) == 'Instance' then
local rightHandOrArm = character:FindFirstChild("RightHand") or character:FindFirstChild("Right Arm")
if rightHandOrArm then
rightHandOrArm:FindFirstChild("Tool"):Destroy()
end
end
end)
Just in case you need something to do with the player, it’s defined there.