Attempt to index index nil with 'Torso'

try this

local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
local WeaponTool = script.Parent

script.Parent.Equipped:Connect(function()

	game.ReplicatedStorage.ConnectM6D:FireServer(WeaponTool.Weapon)
	
	char.HumanoidRootPart.ToolGrip.Part0 = char.HumanoidRootPart
	char.HumnaoidRootPart.ToolGrip.Part1 = WeaponTool.Weapon

end)

WeaponTool.Unequipped:Connect(function()

	game.ReplicatedStorage.DisconnectM6D:FireServer()

end)

‘Torso’ is a part of a r6 NPC/Character, but there is no ‘Torso’ on a r15 NPC/Character,but r6 and r15 NPC/charcaters do have a base(Which is the HumanoidRootPart) and sorry for typos, english is not my main lenguage