Player has to reequip Tool twice to reposition it correctly, and it moves the player slightly when equipping

(I’m just gonna keep this one short because I’m pretty sure that there’s an easy fix for this, but I can’t really figure it out.)

First, I’m temporary using an modified verison of xSIXx’s “Tool Grip to Motor6D” (yes I know, he said don’t change anything inside the script, but I only changed it to correctly position the tool.), if you want to see the code, check at the bottom of this post.

The first problem is whenever the player equips the Tool, a script inside of it deletes the RightGrip Weld and replaces it with a Motor6D version of it, BUT before it replaces it, it use CFrame to position it so the Player can hold the tool correctly. However when equipping the tool for the first time, CFrame doesn’t really works, but when the second time or beyond, it works for whatever reason. Not entirety sure what is causing this…

The second problem is whenever the player equips the Tool, it runs the aforementioned code, but it slightly nudges the player forward a bit, and whenever the Player equips the tool mid-air, it “repositions” them, making this an hassle when they’re trying to escape another player. I definitely know this is something with the CFrame code, let me know if there’s any alternative.

-- xSIXx, Create an animatable joint when tool is equipped.








local motorName = "RightGrip" -- Change this to the target Motor6D name you want in the Right Arm/RightHand.









-- DO NOT CHANGE ANYTHING BELOW. I'm not going to help you solve issues with this script if you have changed any of the code below. --
------------------------------------------------------------------------
-- variables
	local player
	local character
	local humanoid
		local isR15
	local rightHand
------------------------------------------------------------------------
-- stuff
do
	script.Parent.Equipped:connect(function()
		if player == nil then
			player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
		end
		if character == nil or character.Parent == nil then
			character = script.Parent.Parent
			humanoid = character.Humanoid
				isR15 = humanoid.RigType == Enum.HumanoidRigType.R15
			rightHand = isR15 and character:WaitForChild("RightHand") or character:WaitForChild("Right Arm")
		end
		local getWeld = rightHand:WaitForChild("RightGrip")	
		getWeld:Destroy()
		
		script.Parent.Handle.CFrame = rightHand.CFrame:ToWorldSpace(CFrame.new(0,-0.15,0))
		
		local motor = Instance.new("Motor6D")
		motor.Name = motorName
		motor.Part0 = rightHand
		motor.Part1 = script.Parent.Handle
		--motor.C0 = getWeld.C0
		--motor.C1 = getWeld.C1
		
		
		
		motor.Parent = rightHand
	end)
end

Is this happening because this part of the code is hidden?

1 Like

Honestly- I have no idea, but I’m sure that isn’t the problem (since it was commented out before I modified it).

Is the part canCollide false?
The part may be pushing the character because it is colliding with it.

Yes the Handle’s (the part I’m guessing you’re referring to) CanCollide is false.

Also make sure the item is all Massless

They’re already massless beforehand.

Marking this as solved since I’ve already found a easy solution to this. I’ve removed the CFrame piece, then used the Motor6D.C0 to offset it, and added an piece of code that fires whenever the player unequips the Tool to remove the leftover Motor6D, so it won’t be accidentally picked up by the equipped code. This pretty much solves the first and second problems, but creates an new problem where the players equips the tool and it appears to comes out of their arm for a second, I’m already know this is something the tool’s holding animation, so I’m gonna post about this sometime later.

(Also here’s the temporary fixed script for reference.)

-- xSIXx, Create an animatable joint when tool is equipped.








local motorName = "RightGrip" -- Change this to the target Motor6D name you want in the Right Arm/RightHand.









-- DO NOT CHANGE ANYTHING BELOW. I'm not going to help you solve issues with this script if you have changed any of the code below. --
------------------------------------------------------------------------
-- variables
	local player
	local character
	local humanoid
		local isR15
	local rightHand
------------------------------------------------------------------------
-- stuff
do
	script.Parent.Equipped:connect(function()
		if player == nil then
			player = game.Players:GetPlayerFromCharacter(script.Parent.Parent)
		end
		if character == nil or character.Parent == nil then
			character = script.Parent.Parent
			humanoid = character.Humanoid
				isR15 = humanoid.RigType == Enum.HumanoidRigType.R15
			rightHand = isR15 and character:WaitForChild("RightHand") or character:WaitForChild("Right Arm")
		end
		local getWeld = rightHand:WaitForChild("RightGrip")		
		local motor = Instance.new("Motor6D")
		motor.Name = motorName
		motor.Part0 = getWeld.Part0
		motor.Part1 = getWeld.Part1
		--motor.C0 = getWeld.C0
		--motor.C1 = getWeld.C1
		
		motor.C0 = script.Parent.Grip + Vector3.new(0,-0.15,0)
		
		getWeld:Destroy()
		script.Parent.Handle.CFrame = CFrame.Angles()
		motor.Parent = rightHand
	end)
	
	script.Parent.Unequipped:Connect(function()
		local getWeld2 = rightHand:FindFirstChild("RightGrip")
		getWeld2:Destroy()
	end)
end
1 Like