How to animate Tool Parts (Guns, Knifes etc.)

Do you animate the casings too @Headstackk?

Happening to me too. car. (30 limit.)

Whenever I reset my character I lose the model and animation, It’s R6 and the animation is set to the highest priority:

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local reloadsound = script.Parent.Handle:WaitForChild('Reload')
local gun = script.Parent
local clipSize = gun.Ammo.Value
local equipped = true
local UIS = game:GetService('UserInputService')

local tool = script.Parent


local idleAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.IdleAnim)
--local shootAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.ShootAnim)
local reloadAnim = char:WaitForChild("Humanoid"):LoadAnimation(script.ReloadAnim)

tool.Equipped:Connect(function()

    game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)

    char.Torso.ToolGrip.Part0 = char.Torso
    char.Torso.ToolGrip.Part1 = tool:WaitForChild("BodyAttach")


    idleAnim:Play()
end)

tool.Unequipped:Connect(function()

    game.ReplicatedStorage.DisconnectM6D:FireServer()

    idleAnim:Stop()
end)

UIS.InputBegan:Connect(function(input, gameprocessed)
    if not gameprocessed then
        if input.UserInputType == Enum.UserInputType.Keyboard then
            local keycode = input.KeyCode
            if keycode == Enum.KeyCode.R then
                        if gun.Ammo.Value < clipSize and gun.MaxAmmo.Value > 0 and gun.Equipped then
                            if not equipped then
                                return
                            end
                    reloadsound:Play()
                    
                    char.Torso.ToolGrip.Part0 = char.Torso
                    char.Torso.ToolGrip.Part1 = tool:WaitForChild("BodyAttach")
                    
                    reloadAnim:Play()
                end
            end
        end    
    end
end)


--tool.Activated:Connect(function()

    --shootAnim:Play()
--end)

Gunserver:

game.Players.PlayerAdded:Connect(function(plr)            
    plr.CharacterAdded:Connect(function(char)

        local M6D = Instance.new("Motor6D", char.Torso)
        M6D.Name = "ToolGrip"
    end)
end)

game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)

    local char = plr.Character
    char.Torso.ToolGrip.Part0 = char.Torso
    char.Torso.ToolGrip.Part1 = location


end)

game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
    plr.Character.Torso.ToolGrip.Part1 = nil
end)

@Headstackk one question, would this be possible by not making any scripts? I feel like this is very easy to exploit…
But other than that, this is a very cool tutorial!! I will be sure to use this!!

Might use this, but can you give also a tutorial how you can damage players while shooting, or us it already included

for shooting i recommend fastcast

Thx for the info, now can I use some better gun system I guess :stuck_out_tongue:

1 Like

In-game, the animation plays on the body but not on the gun. This works fine with a test dummy and ROBLOX animator.

nice tutorial but the second time i do it the gun wont move to the torso?

Hello,

I have a really weird problem, i name one of my part of my butterfly knife Handle and after the anim i realise i have to rename but if i rename it’s removing the animation

Someone know how i can resolve this problem ?

how to stick the tool to the right arm? but if I try to weld. it won’t work properly

I tried to make it work with Lightsaber but it show two error that said ToolGrip is not a valid member of MeshPart “Workspace.DeathLilian.UpperTorso” - Client - LightsaberClient:15 and ToolGrip is not a valid member of MeshPart “Workspace.DeathLilian.UpperTorso” - Server - LightsaberServer:13
This is from output

  16:08:30.051  ToolGrip is not a valid member of MeshPart "Workspace.DeathLilian.UpperTorso"  -  Client - LightsaberClient:15
  16:08:30.052  Stack Begin  -  Studio
  16:08:30.052  Script 'Players.DeathLilian.Backpack.Test.LightsaberClient', Line 15  -  Studio - LightsaberClient:15
  16:08:30.052  Stack End  -  Studio
  16:08:30.099  ToolGrip is not a valid member of MeshPart "Workspace.DeathLilian.UpperTorso"  -  Server - LightsaberServer:13

Here a gif of what wrong with it

Is there any way to fix it?

1 Like

does this still work? it says toolgrip is not a valid member.

1 Like

"Idle is not a valid member of LocalScript “Players.ToxicalGamer2006.Backpack.MLG Sniper.Animations”

Why when the player dies this happen?

I changed the script for :FindFirstChild(“ToolGrip”) it works but afther that I get problems from animations

I found one way really simple

On tool.Equipped function I changed all transparency tool parts to 1 and I played the Idle animation then I did wait(0.1) and I changed all tool transparency parts to 0.

will it fixed but where I put :FindFirstChild(“ToolGrip”) in it?

1 Like

Maybe. But I think this is kinda outdated bc when you die this broke…

Ah okay, I think it need a update because it still not worked for me since almost a month…

Edit: Wait…. It only work with R6 but not R15? But when I test with R6 and it worked fine but if I test it on R15 and it give same errors…

1 Like

Is here any way to fix when the players dies?

I am having this problem: Screen capture - 97304819928be48480445c8d1f19da35 - Gyazo

Edit: Nvm I fixed

1 Like