Motor6D won't go into characters UpperTorso

I have a script which is meant to put a motor6D in the players Upper Torso, but when I play it, it prints that it created the motor6D but it didn’t. I can’t figure out why it isn’t working since I watched a youtube tutorial and even tried out the model to get it to work, but still it didn’t work.

Here’s the script

game.Players.PlayerAdded:Connect(function(plr)			
	plr.CharacterAdded:Connect(function(char)		
		local M6D = Instance.new("Motor6D", char.UpperTorso)
		M6D.Name = "ToolGrip"
		print("Made Motor6D")
	end)
end)

game.ReplicatedStorage.ConnectM6D.OnServerEvent:Connect(function(plr,location)
	local char = plr.Character
	char.UpperTorso.ToolGrip.Part0 = char.UpperTorso
	char.UpperTorso.ToolGrip.Part1 = location
end)

game.ReplicatedStorage.DisconnectM6D.OnServerEvent:Connect(function(plr)
	plr.Character.UpperTorso.ToolGrip.Part1 = nil

Thank you!

1 Like

As a general rule of thumb you should parent the instance after it has been created, such as in the following.

local M6D = Instance.new("Motor6D")
M6D.Parent = char.UpperTorso
2 Likes

Try CharacterAppearanceLoaded and WaitForChild

game:GetService("Players").PlayerAdded:Connect(function(plr)			
	plr.CharacterAppearanceLoaded:Connect(function(char)		
		local M6D = Instance.new("Motor6D", char:WaitForChild("UpperTorso"))
		M6D.Name = "ToolGrip"
		print("Made Motor6D")
	end)
end)

game:GetService("ReplicatedStorage").ConnectM6D.OnServerEvent:Connect(function(plr, location)
	local char = plr.Character
	if not char then		return		end
	
	local UT = char:WaitForChild("UpperTorso")
	local TG = UT:WaitForChild("ToolGrip")
	TG.Part0 = UT
	TG.Part1 = location
end)

game:GetService("ReplicatedStorage").DisconnectM6D.OnServerEvent:Connect(function(plr)
	local char = plr.Character
	if char then
		char:WaitForChild("UpperTorso"):WaitForChild("ToolGrip").Part1 = nil
	end
1 Like

This. And here’s why:

PSA: Don’t use Instance.new() with parent argument - Updates / Announcements - DevForum | Roblox

1 Like

Tried this, still doesn’t work.

Go look at the model in the server side and see if the motor6d simply failed to replicate on the client.

I don’t understand why, but today it just started working again?

2 Likes