I am currently following this tutorial: How to animate Tool Parts (Guns, Knifes etc.)
But, when I equip my tool, it just goes straight to my UpperTorso and just stays there, when I click, it plays the animation with the tool just sitting in the UpperTorso.
I don’t believe it’s a scripting issue, it might be, any fixes?
Server Side
local torsoPart = "UpperTorso"
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local M6D = Instance.new("Motor6D", char[torsoPart])
M6D.Name = "ToolGrip"
end)
end)
game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
local torso = plr.Character[torsoPart]
local toolGrip = torso["ToolGrip"]
if location then
toolGrip.Part0 = torso
end
toolGrip.Part1 = location -- if location is nil, this becomes nil
end)
Client Side
local torsoPart = "UpperTorso"
local WeaponTool = script.Parent
local toolGrip = char:WaitForChild(torsoPart):WaitForChild("ToolGrip")
local bodyAttach = WeaponTool:WaitForChild("BodyAttach")
local function fire(...)
game.ReplicatedStorage.ConnectM6D:FireServer(...)
end
WeaponTool.Equipped:Connect(function()
fire(bodyAttach)
toolGrip.Part0 = char.UpperTorso
toolGrip.Part1 = bodyAttach
end)
WeaponTool.Unequipped:Connect(function()
fire()
end)
local torsoPart = "UpperTorso"
game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
local char = plr.Character or plr.CharacterAdded:Wait()
-- less work and just one remote event needed
local M6D = Instance.new("Motor6D", char[torsoPart])
M6D.Name = "ToolGrip"
local torso = plr.Character[torsoPart]
local toolGrip = torso["ToolGrip"]
if location then
toolGrip.Part0 = torso
end
toolGrip.Part1 = location -- if location is nil, this becomes nil
end)