Apparently, whenever I equip my gun and the animation plays, the arms glitch out for a second and then go back into place. It makes the gun seem unnatural:
Any help?
For some reason, whenever I equip the tool it will just attach it to my character’s body, animate the arms but not the tool, any reason why this could happen?
Don’t set part0 to HRP, set it to torso or uppertorso, because uppertorso animates with the run, and that makes the gun move with the character animations, otherwise the arms move and the gun doesn’t because HRP can’t be animated
I have this problem: my tool is teleported back where it was left when it was unequipped. I have only tested from Roblox Studio.
However great tutorial
+1 This is a very helpful tutorial, but I have a few things to ask.
Would I have to animate the equipped and unequipped actions for my tool? I was fine with the default one, but now whenever I equip my tool the right arm doesn’t go up as if it was a normal tool.
Now, my tool is stuck in the torso, but I already made sure that the tool is unanchored, not welded, and each line of code is working. I think it may be the hot weather, but I can not figure out what is wrong. How would I position it to be on the right arm?
I wish the tutorial was a little more clear in how the tool is positioned.
Here is the code, which is basically what is seen in the tutorial. (I hope)
Client
-- [[ Services ]] --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
-- [[ Tool ]] --
local zapperTool = script.Parent
-- [[ Remotes ]] --
local remoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local ConnectMotor6D = remoteEvents:WaitForChild("ConnectMotor6D")
local DisconnectMotor6D = remoteEvents:WaitForChild("DisconnectMotor6D")
-- [[ Player ]] --
local localPlayer = Players.LocalPlayer
local localCharacter = localPlayer.Character or localPlayer.CharacterAdded:wait()
local localHumanoid = localCharacter:WaitForChild("Humanoid")
local mouse = localPlayer:GetMouse()
local toolGrip = localCharacter.Torso:WaitForChild("ToolGrip")
local bodyAttach = zapperTool:WaitForChild("BodyAttach")
-- [[ Animations ]] --
local zapperFire = zapperTool:WaitForChild("ZapperFire")
local zapperFireTrack = localHumanoid:LoadAnimation(zapperFire)
zapperTool.Equipped:Connect(function()
ConnectMotor6D:FireServer(bodyAttach)
toolGrip.Part0 = localCharacter.Torso
toolGrip.Part1 = bodyAttach
end)
zapperTool.Unequipped:Connect(function()
DisconnectMotor6D:FireServer()
end)
-- Fires onZap to server and changes appearance of zapper
zapperTool.Activated:Connect(function()
zapperFireTrack.Priority = Enum.AnimationPriority.Action
zapperFireTrack.Looped = false
zapperFireTrack:Play()
end)
Summary
-- [[ Services ]] --
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvents = ReplicatedStorage:WaitForChild("RemoteEvents")
local ConnectMotor6D = remoteEvents:WaitForChild("ConnectMotor6D")
local DisconnectMotor6D = remoteEvents:WaitForChild("DisconnectMotor6D")
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local motor6D = Instance.new("Motor6D")
motor6D.Parent = character.Torso
motor6D.Name = "ToolGrip"
end)
end)
ConnectMotor6D.OnServerEvent:Connect(function(player,location)
local character = player.Character or player.CharacterAdded:wait()
character.Torso.ToolGrip.Part0 = character.Torso
character.Torso.ToolGrip.Part1 = location
end)
DisconnectMotor6D.OnServerEvent:Connect(function(player)
player.Character.Torso.ToolGrip.Part1 = nil
end)