My script wont add a new instance (Motor6D) to the UpperTorso

For some reason whenever I test my game out my script wont add a new Motor6D to the Upper Torso? I put the script in ServerScriptService and I set the Avatar to r15. heres my script:

 game.Players.PlayerAdded:Connect(function(player)			
	player.CharacterAdded:Connect(function(character)	

		local motor6d = Instance.new("Motor6D")
		motor6d.Name = "GunMotor6D"
		motor6d.Part0 = character.UpperTorso
		motor6d.Parent = character.UpperTorso
	end)
end)
1 Like

does the output have any errors? also, you should use prints or breakpoints to confirm that each part of this script is running

1 Like

There are currently no errors at all?

make a localscript under starterplayerscripts then paste this code into it

game.Players.LocalPlayer.CharacterAdded:Connect(function(player)
	task.wait()
	local motor6d = Instance.new("Motor6D")
	motor6d.Name = "GunMotor6D"	
	motor6d.Parent = game.Players.LocalPlayer.Character.UpperTorso
	motor6d.Part0 = game.Players.LocalPlayer.Character.UpperTorso
end)
1 Like

did you see if prints are working?

also, how are you checking that the motor6D isn’t being added?

1 Like

Thanks for all the replies guys, I’ll try it tommorow have a good day!