Really strange issue with setting Motor6D / Possible studio bug?

Hi there, I was working on a gear for a game I am working on, and I entered a local server with two clients to see how the animations looked for other players. The animation looked fine for the person doing it, but for other players, not so much. I am not exactly sure whether this is an issue with how I set the Tool’s root Motor6D (The tool is set around a base part, so all of the parts stay together), or if its something to do with how I executed the animations.

So the issue is, when I run the equip animation, the tool’s root Motor6D has its Part0 set to the character’s right hand. The tool is brought and aligned to the hand like it is supposed to, but it isn’t affected by the animation. The tool is supposed to move so that it looks more like the character is grabbing it, rather than sticking their arm through it. The rest of the characters animation (apart from the tool’s) plays normally.

Now here is where it is weird: The tool actually fixes itself when another character comes close to it, and I have absolutely no idea why. Here is a GIF that I took of it happening. (At the start, the case is not offset from the right hand, but once another character walks near it, it fixes for that player.)
https://streamable.com/6933p8

Resources (Scripts, Model, etc.)

Model:
image

ServerScript in ServerScriptService:

local function getAnimationFromId(AnimId)
	local animation = Instance.new("Animation")
	animation.AnimationId = "rbxassetid://".. AnimId
	return animation
end
	
	
local animations = {
	["MedkitAdvanced"] = {
		equip = (getAnimationFromId(6776533191)),
		hold = (getAnimationFromId(6777024407))
	}
}

function equipItem(plr, itemID, invItem)
	local char = plr.Character or plr.CharacterAdded
	local hum = char:WaitForChild("Humanoid")
	local anmtr = hum:FindFirstChildOfClass("Animator")
	
	if itemID == "MedkitAdvanced" then
		local equipAnim = anmtr:LoadAnimation(animations[itemID].equip)
		local holdAnim = anmtr:LoadAnimation(animations[itemID].hold)
		
		local defaultAttach = char:FindFirstChild("RightHand")
		local motor = Instance.new("Motor6D", invItem.Root)
		motor.Name = "Attach"
		motor.Part1 = invItem.Root
		motor.Part0 = defaultAttach
		
		if invItem and defaultAttach and motor then
			hum:EquipTool(invItem)
			equipAnim:Play()

			equipAnim.Stopped:Connect(function()
				if invItem.Parent == char then
					holdAnim:Play()
				end
			end)
			
			
		end
	end
	
end

game.ReplicatedStorage.Equipment.Equip.OnServerInvoke = function(plr, item)
	local invItem = plr:FindFirstChild("Backpack"):FindFirstChild(item)
	if invItem then
		print(invItem)
		equipItem(plr, item, invItem)
	end
end

In addition, what you do to equip is just run this command:

game.ReplicatedStorage.Equipment.Equip:InvokeServer("MedkitAdvanced")

I have tried removing Head/Body turning, and I have tried both having the Motor6D parented to the root by default, and having it added via Instance.new() but still the same issue.

Other than this, I have absolutely no idea what is causing this, any ideas that I can think of that might be the problem are countered by the fact that it fixes itself when a player comes near. Thank you for reading!

3 Likes

You need to create the motor6d before the player triggers it to attach.
sort of something like this:

game.Players.PlayerAdded:Connect(function(player)
   player.CharacterAdded:Connect(function(char)
     local motor = Instance.new("Motor6D", invItem.Root)
	 motor.Name = "Attach"
    end)
end)
-- where ever your trigger the motor6d to connect or whatever
motor.Part1 = invItem.Root
motor.Part0 = defaultAttach

i’ve had something like this happen to myself, I think it is a studio bug considering that it just started to happen but this is a work around for right now.

Sorry for the late reply, I will try it out. Thanks!

Ok, so I have been tinkering with it for a while, and I think I found a solution. I’m not the most pleased with this solution, since it depends on a wait but this is what I changed:
image
if anyone has a better idea on how to make this more reliable I’m open to ideas. Thanks!

This does not work, and the issue with motor6Ds is still ongoing

Dont use tool.Equipped check character child added, and then you can do the c0 and c1 stuff etc. Equipped is not fast as child added and the motor6d replication is not working because of that.