Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Motor6D attaching weapon to player incorrectly?

Hi, so my weapon is connecting to the torso character incorrectly. Instead of it attaching to the torso, it floats to the left of my character.

Tutorial I was using: https://devforum.roblox.com/t/how-to-animate-tool-parts-guns-knifes-etc/359484

Screenshot: https://lh3.googleusercontent.com/-XGrQjdPIzu4/XyqgCQsj-BI/AAAAAAAAF3U/xFf_FZ8wi-wNufnx2i83DTjOHYhEHHjGwCK8BGAsYHg/s0/2020-08-05.png

Server Motor6D script

game.ReplicatedStorage.ChangeMotor6D.OnServerEvent:Connect(function(plr, todowithit, weapon)
	--plr.Character.Torso
	if todowithit == false then
		plr.Character.Torso.Motor6D:Destroy()
	else
		local motor6d = Instance.new("Motor6D", plr.Character.Torso)
	end
end)

Client Motor6D script

game.ReplicatedStorage.ChangeMotor6D:FireServer(true, tool)
local motor6d = player.Character.Torso:WaitForChild("Motor6D")
motor6d.Name = "WeaponAttach"
motor6d.Part0 = player.Character.Torso
motor6d.Part1 = tool.BodyAttach

1 answer

I ended up fixing it. I'm not entirely sure how, but I'm pretty sure it was because I had a handle (big no-no when it comes to animating guns) and it made the weapon go to the arm instead of the torso. It could also be because i duplicated the motor6D from a pre-existing motor6D. Another big no-no I think. Anyway, if you have the same problem as I have, try fixing it through the 2 methods I mentioned.

This discussion is preserved as it was. New answers, comments, and votes are closed.