Motor6d not working

Hello there, I’ve followed this tutorial: How to animate Tool Parts (Guns, Knifes etc.) - Resources / Community Tutorials - DevForum | Roblox on how to weld guns with a Motor6d and did everything right yet I get this result:

image

I have the same script and if your wondering, my gun is made of UnionOperations (Just thought I’d put that in.).

I’m also using R6 if your wondering too…

If you need more information please tell me!, Any help is appreciated. Thanks!

1 Like

Actually a motor6D is suppose to do that if you have weld it already then you can start animating it. try giving the script if you can.

Here is my script for the client:

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

script.Parent.Equipped:Connect(function()

	game.ReplicatedStorage.ConnectMOTOR6D:FireServer(WeaponsTool.BodyAttach)
	
	repeat wait(1) until char.Torso:FindFirstChild("ToolGrip")
	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = WeaponsTool.BodyAttach

end)

WeaponsTool.Unequipped:Connect(function()
	
	game.ReplicatedStorage.DisconnectMOTOR6D:FireServer()

end)

Server:

game.Players.PlayerAdded:Connect(function(plr)			
	plr.CharacterAdded:Connect(function(char)

		local M6D = Instance.new("Motor6D", char.Torso)
		M6D.Name = "ToolGrip"
	end)
end)

game.ReplicatedStorage.ConnectMOTOR6D.OnServerEvent:Connect(function(plr,location)
	
	local char = plr.Character
	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = location

end)

game.ReplicatedStorage.DisconnectMOTOR6D.OnServerEvent:Connect(function(plr)
	plr.Character.Torso.ToolGrip.Part1 = nil
end)

If you do not want to use a tool, you could use SetPrimarypartCFrame then mess around with the angles, then set the Motor6D up.Though I’d say you just use tools.

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

script.Parent.Equipped:Connect(function()

	game.ReplicatedStorage.ConnectMOTOR6D:FireServer(WeaponsTool.BodyAttach)
	WeaponsTool:SetPrimaryPartCFrame(char:FindFirstChild("Right Arm").CFrame)
	repeat wait(1) until char.Torso:FindFirstChild("ToolGrip")
   
	char.Torso.ToolGrip.Part0 = char.Torso
	char.Torso.ToolGrip.Part1 = WeaponsTool.BodyAttach

end)

This is what it would look like

Could you possibly show a Image/Video of how this would work?, what do you mean by using :SetPrimaryPartCFrame?

This first screenshot shows the test model that I am using. Its called “thisisatestmodel”.

In the bottom left you can see that the primaryPart is set to the part, in your case set this to whatever the handle of the gun is. Also make sure the handle is facing forward, or else it will look the wrong way.

In this screenshot below, all I did was use SetPrimaryPartCFrame to set the primary part’s, the part I set as the Primary Part earlier, CFrame to the right arm’s CFrame

The link/video below shows it working

https://streamable.com/731wfb

If this doesn’t help look at this link
https://developer.roblox.com/en-us/api-reference/function/Model/SetPrimaryPartCFrame

Thanks!, I understood but how would I get the left arm to weld/Move to the object to?

You would use SetPrimaryPartCFrame on the tool model

ToolModel:SetPrimaryPartCFrame(--The left arm's CFrame goes in here)

keep in mind this only works if it is a model and not a tool

And then this will weld both the RightArm and LeftArm?, also. Is there anyway I could do this with a animation and then use :SetPrimaryPartCFrame on the Animation?

You could use a tool. First put the model in the tool, make sure its just the parts and not an actual model. There should also be a part called “Handle” in the tool. Make sure this part is directly on the part of the gun that you consider the handle. Then put a duplicate of the tool in a dummy and it should automatically equip it. From their you can animate it. You could also just put the tool in the starterpack. This would make it a lot easier instead of manually welding everything. Also make sure the “Handle” part is facing the correct way, if it isn’t the tool will face the wrong way.

Yea I know how to animate it but instead, back to my first question: “This will weld both the Left and Right arm?”

using SetPrimaryPartCFrame() will only move the model to the CFrame, not weld it.