When you equip a tool, there is a weld which welds the Right Arm (R5) or RightHand (R16) to the tool, You can use the parameters of the weld for the M6D, and then break it after your done. Here is an example:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEventsFolder = ReplicatedStorage:WaitForChild("RemoteEvents")
local Init_M6D = RemoteEventsFolder:WaitForChild("Init_M6D")
local Destroy_M6D = RemoteEventsFolder:WaitForChild("Destroy_M6D")
local function Init(player)
local char = player.Character
local a = char:FindFirstChild("Right Arm"):WaitForChild("RightGrip")
local m6d = Instance.new("Motor6D")
m6d.Parent = char:FindFirstChild("Right Arm")
m6d.Name = "RightGrip"
m6d.Part0 = a.Part0
m6d.Part1 = a.Part1
m6d.C0 = a.C0
m6d.C1 = a.C1
a:Destroy()
return m6d
end
Init_M6D.OnServerInvoke = Init
Destroy_M6D.OnServerEvent:Connect(function(player, M6D)
M6D:Destroy()
end)
function setup(Character)
local handle = ReplicatedStorage.CombatFolder.Sword.Fx.Handle:Clone()
handle.Parent = Character
local Motor6d = Instance.new("Motor6D", Character["Right Arm"])
Motor6d.Part0 = Character["Right Arm"]
Motor6d.Part1 = handle
handle.CFrame = Character["Right Arm"].CFrame * CFrame.new()
Motor6d.C1 = CFrame.new(0, 1, 0 ) -- Changes the position/Offset of the sword on the Arm
end```