hey guys so i want to make motor6d work with a tool without handle
i have tried alot of tutorials but none of them work and i dont really understand how to make it
basically when i equip the tool it doesnt appear in my hands and dissapear in 1 second from my inventory (i do have idle animation in local script)
this is the code that i have right now (server script)
Tool.Equipped:Connect(function()
local char = script.Parent.Parent
local M6D = Instance.new("Motor6D", char:FindFirstChild("Right Arm"))
M6D.Name = "Body"
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") and child:FindFirstChild("Body") then
M6D.Part1 = child.Body
end
end)
end)
Now I see, while creating Motor6D you need to set Part0 property to one of the character’s parts and Part1 property to some part in your tool to weld them together. Also you need to implement something that will prevent creating multiple Motor6Ds from creating when player equips it multiple times
local char = script.Parent.Parent
local M6D = Instance.new("Motor6D", char:FindFirstChild("Right Arm"))
M6D.Name = "Body"
M6D.Part0 = char:FindFirstChild("Right Arm")
char.ChildAdded:Connect(function(child)
if child:IsA("Tool") and child:FindFirstChild("Body") then
M6D.Part1 = child.Body
end
end)
Tool.Equipped:Connect(function()
local char = Tool.Parent
local arm = char:FindFirstChild("Right Arm")
if not arm then return end
local M6D = Instance.new("Motor6D")
M6D.Name = "Body"
M6D.Part0 = arm
M6D.Part1 = Tool.Body
M6D.Parent = arm
end)
I think its because when you set Part0 (the arm) and Part1 (the tool) it changes Part1’s position to be the same as Part0. The position is the center of the part which is why the gun is in the center of the arm. Maybe try adding a part that sticks out on the end of your character’s arm and set Part0 to that part? I think that will fix the problem of the gun being inside your character’s arm but not the orientation of it.