Creating Motor6D with Script doesnt work

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve?
    I want to make a new Motor6D when the Tool is Equipped and delete it when the tool is Unequipped

  2. What is the issue?


    The Motor6D isn’t Created (its called Motor7D) and the Tool is placed at the origin
    also the tool has RequireHandle = False
    (its supposed to look like this on the character)

Here is The Code:

--local script(inside the Tool)
local tool = script.Parent

local Player = game:GetService("Players").LocalPlayer
local char = Player.Character or Player.CharacterAdded:Wait()
local Hum = char:FindFirstChildOfClass("Humanoid")

local Animator = Hum:WaitForChild("Animator")
local AnimIdle = Instance.new("Animation")
AnimIdle.AnimationId = "rbxassetid://11759349459"
local AnimIdleTrack = Animator:LoadAnimation(AnimIdle)
AnimIdleTrack.Priority = Enum.AnimationPriority.Idle
AnimIdleTrack.Looped = true


tool.Equipped:Connect(function()
	game:GetService("ReplicatedStorage").Events.OnToolEquip:FireServer(char, tool)
	AnimIdleTrack:Play()
end)

tool.Unequipped:Connect(function()
	game:GetService("ReplicatedStorage").Events.OnToolunEquip:FireServer(char, tool)
	AnimIdleTrack:Stop()
end)
--script (ServerScriptService)
local RP = game:GetService("ReplicatedStorage").Events


RP.OnToolEquip.OnServerEvent:Connect(function(plr, char, tool)
	local Torso = char:FindFirstChild("UpperTorso")
	
	local m6d = Instance.new("Motor6D")
	m6d.Parent = char:FindFirstChild("UpperTorso")
	m6d.Part0 = Torso
	m6d.Part1 = tool.BodyAttach
	m6d.Name = "Motor7d"
end)

RP.OnToolunEquip.OnServerEvent:Connect(function(plr, char, tool)
	local m6d = char:FindFirstChild("UpperTorso").Motor7d
	m6d:Destroy()
end)


if there is anything that i should improve in my code plz notify be about it

Try making the Torso side RightHand

its kind of the same. the problem isnt in which part in the character. its the motor6d not even being created. thanks though :smiley:

I’ve had trouble getting the Motor6 created in the Torso.

If I remember I could only make that happen inside the player’s head or the humanoid root part.

For some reason I cannot get any motor to be created anywhere else in any character and have asked before and never gotten this response as to why.

So just go with human root part and it’ll work the same.

1 Like

i found the problem is fixed when i commented the Animation variable to play the animation. idk why but ig it works without animation , thanks for all your guys help!

If you aren’t planning on animating the weapon, you should use a Weld instead. I’m not sure why people are now using Motor6D and Weld interchangeably.

I assume tool.BodyAttach isn’t an attachment? It needs to be a basepart. Also, you set any offsets for the motor, so it’ll end up sticking the tool into the middle
of your body when it does work.