Hey there. I’ve been trying to figure out how to solve this problem occurring when I try to equip a tool. I’ve been using Headstack’s method of animating a tool which connects a Motor6D’s Part1 to a tool’s artificial Handle with the M6D’s Part0 connected to the Character’s Torso. This connection is done both in server and in the client to guarantee that no delays will occur.
However, no matter what, this bug happens:
https://gyazo.com/dd6c5c7e3a49a782e5dfb906fbdd3edc
Having been under this frustration for a while now, the tool seems to glitching and for a fraction of a second begins at the LAST position it was in before being unequipped.
I have tried switching the order of connection, server first then client via remotes and vice versa. I’ve tried doing the connection on the server or client exclusively and a whole bunch of things. Nothing seems to solve it. I’m trying to dismiss the hacky ways to solve this like having the tool invisible until the glitch. Has anybody solved this or found a way out of this problem?
-- # Server Script
local function CharacterAdded(Character)
-- Inside a PlayerAdded function
local Torso = Character:FindFirstChild("Torso")
local GripM6D = Instance.new("Motor6D")
GripM6D.Name = "Grip"
GripM6D.Part0 = Torso
GripM6D.Parent = Torso
Character.ChildAdded:Connect(function(child)
if child:FindFirstChild("BodyHandle") then
GripM6D.Part1 = child.BodyHandle
end
end)
end
Player.CharacterAdded:Connect(CharacterAdded)
CharacterAdded(Player.Character or Player.CharacterAdded:Wait())
-- # Client (in a modulescript)
-- connects M6D on the client side
self.Character.ChildAdded:Connect(function(child)
if Grip and child == self.Tool then
Grip.Part0 = Torso
Grip.Part1 = self.Tool.BodyHandle
end
end)
local anim
local function Equip()
-- just to hastily test it with an animation playing
local track = ReplicatedStorage.Animations.M1Garand.Aim.Aiming
anim = self.Character.Humanoid.Animator:LoadAnimation(track)
anim:Play()
end
self.Tool.Equipped:Connect(Equip)
Thanks!