Everytime I weld something to my viewmodel, my character starts flying [SOLVED]

This is most definitely a collision issue, but everything I seem to try fails to accomplish anything. All of my tool parts are massless and cancollide off, the same with my viewmodel. Ive tried changing the properties of my tools and viewmodel parts to no avail, I have looked all over the dev forum but nothing seems to work. Here is my script:

local RunService = game:GetService("RunService")
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Assets = ReplicatedStorage.Assets
local Modules = ReplicatedStorage.Modules

local Configuration = require(script.Parent)
local Utilities = require(Modules.Utilities)

local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local Camera = workspace.CurrentCamera

local Viewmodel = Assets:WaitForChild("Viewmodel"):Clone()
Viewmodel.Parent = Camera

local CurrentGrip = nil

local function ReplicateAnimationToViewmodel()
	for _,v: Motor6D in ipairs(Viewmodel:GetDescendants()) do
		if v:IsA("BasePart") then
			v.CanCollide = false
		end
		if v:IsA("Motor6D") and v.Name ~= "Handle" then
			v.Transform = Character:FindFirstChild(v.Name, true).Transform
		end
	end
end

Character.ChildAdded:Connect(function(Child : Instance)
	if Child:IsA("Tool") then
		CurrentGrip = Child:FindFirstChild("ToolGrip")
	end
end)
Character.ChildRemoved:Connect(function(Child : Instance)
	if Child:IsA("Tool") then
		CurrentGrip = nil
	end
end)


local RATE_PER_SECOND = 0

RunService.RenderStepped:Connect(function(step)
	local increment = RATE_PER_SECOND * step
	Viewmodel.PrimaryPart.CFrame = game.Workspace.CurrentCamera.CFrame
	
	ReplicateAnimationToViewmodel()
	
	if CurrentGrip and CurrentGrip.Part0 ~= Viewmodel["Handle"] then
		CurrentGrip.Part0 = Viewmodel["Handle"]
	end
	
end)

Viewmodedl

Here is the script that adds the Motor6D to the tool:

if Configuration.CustomGripEnabled then
		local ToolGrip = Instance.new("Motor6D")
		ToolGrip.Name = "ToolGrip"
		ToolGrip.C0 = Configuration.CustomGripC0
		ToolGrip.C1 = Configuration.CustomGripC1
		ToolGrip.Part0 = Character:WaitForChild("Right Arm")
		ToolGrip.Part1 =  GripPart
		ToolGrip.Parent = Tool
	end

And here is some extra configuration variables I use in the script above:

CustomGripEnabled = true;
	GripPart = "Handle";
	CustomGripC0 = CFrame.new();
	CustomGripC1 = CFrame.new();

Any help would be appreciated as I have been tackling this bug for 2 days now and have switched viewmodel models twice.

Edit: I solved it on my own.
If anyone else has this problem, all I did was make a clone of the tools handle and weld that instead. I also make the actual tool invisible so only the Viewmodel handle is visible

1 Like