Automatic Generational Welding Position & Orientation Correction (For Animation Changes) - [SOLVED]

Hello, so recently I made this Automatic Welding Script (Grip2Motor6D), I’ve been really satisfied with it but I realized it is fixed to its position and if I try to rotate it doesn’t, Not meaning to ask for “Free Scripts” but can anyone help what do I have to do?

I tried doing RunService:Heartbeat but it just creates a floating point glitch, It may be due to my unskilled level of code

Overview:

  • Tried fixing it using RunService:Heartbeat but it creates a floating point glitch
  • Tried to Track and detect every position and orientation change but it “Flipped the arms around” and broke everything
  • Asked Ai, seriously doesn’t help

Other Info :

  • Using custom-made FEGK (FE Gun Kit)
  • Using Animations

Error Videos Provided :

Animation -

With Script -

My code (Without RunService:HeartBeat) :

--Needed Variables
local bin = script.Parent
local mainsign = "> Autoweld for a selected weapon is on! Make sure every input is correct! <"
local errorsign = "Error - AutoWeld"
local errordetectionsign = "Detected - AutoWeld"
local handle = bin.Handle --change to your MAIN part/handle
local motorLib = {}
motorLib.__index = motorLib

--Gun Variable
local GunGrip1 = bin.GunModel.Base 
--local GunGrip2 = print(errordetectionsign.." | No GunGrip2 Detected!")

print(mainsign) --Precaution, can be removed

--All the good stuff B )
function motorLib.new(char)
	local newMotor = {}
	local rigType = char:FindFirstChild("Humanoid").RigType
	local handLocation
	if rigType == Enum.HumanoidRigType.R15 then handLocation = char:FindFirstChild("HumanoidRootPart") end
	if rigType == Enum.HumanoidRigType.R6 then handLocation = char:FindFirstChild("HumanoidRootPart") end
	if handLocation then
		if handLocation:WaitForChild("RightGrip") then
			handLocation.RightGrip:Destroy()
		end
		local Motor6DHandle = Instance.new("Motor6D")
		Motor6DHandle.Parent = handLocation
		Motor6DHandle.Name = "RightGrip"
		Motor6DHandle.Part0 = handLocation
		Motor6DHandle.Part1 = GunGrip1
		Motor6DHandle.C0 = CFrame.new(-1.462, 0.131, -0.491) * CFrame.Angles(0, math.rad(-180), 0)
		Motor6DHandle.C1 = CFrame.new(0, 0, 0) * CFrame.Angles(0, 0, 0) --CFrame.New as position & CFrame.Angles as orientation.
		newMotor.RigType = rigType
		newMotor.Location = handLocation
		newMotor.Owner = handLocation.Parent
		newMotor.MotorObject = Motor6DHandle
		return newMotor
	else
		error("[!] Player does not have an arm")
		return
	end
end
function motorLib.delete(Motor6D)
	Motor6D.MotorObject:Destroy()
end

--Normal Functions
bin.Equipped:Connect(function()
	local char = bin.Parent
	local motor6d = motorLib.new(char)
	bin.Unequipped:Connect(function()
		motorLib.delete(motor6d)
	end)
end)

Please tell me what I need to improve, Thanks. (Not meaning to ask for free scripts)

It was because the Weld is “Base” not “RightGrip”

me being yes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.