Motor6D not moving Model

I currently have a viewmodel and a weapon, I am trying to move the weapon into the ViewModel via a Motor6D through the script below

local ItemDataModule = require(game.ReplicatedStorage.GameSettings.ItemData)
local MainModule = require(game.ReplicatedStorage.MainModule)
local SpringModule = require(game.ReplicatedStorage.SpringModule)

local RecoilSpring = SpringModule.new()
local BobbleSpring = SpringModule.new()
local SwayingSpring = SpringModule.new()

local EquipEvent = game.ReplicatedStorage.WeaponEvents.EquipEvent

local Camera = game.Workspace.CurrentCamera

local RunService = game:GetService("RunService")

local ItemEquipped = false

function ViewmodelWeld(Item, hotbarNumber)
	print("Viewmodel weld")
	print(Item, hotbarNumber)
	local Viewmodel = game.ReplicatedStorage["viewmodel arms"]:Clone()
	local Weapon = game.ReplicatedStorage.StoredItems[Item]:Clone()
	Weapon.Parent = Viewmodel
	Viewmodel.Parent = game.Workspace.CurrentCamera
	Viewmodel.Name = "Viewmodel"
	
	local Weld = Instance.new("Motor6D")
	Weld.Name = "HandleWeld"
	Weld.Part0 = Viewmodel.Main
	Weld.Part1 = Weapon.Handle
	
	local WeldOffset = ItemDataModule[Item].Offsets.Client
	Weld.C0 = CFrame.new(WeldOffset.Position) * WeldOffset.Rotation
	Weld.Parent = Viewmodel.Main
	print("Should have welded correctly I think")
	
	local PartTable = { -- Could make into loop, but this is easier, plus its not like anyone is gonna see this
		--Viewmodel
		Viewmodel.LSleeve,
		Viewmodel.RSleeve,
		Viewmodel.Lglove,
		Viewmodel.Rglove,
		--Left Sleeve Textures
		Viewmodel.LSleeve.Texture,
		Viewmodel.LSleeve.Texture2,
		Viewmodel.LSleeve.Texture3,
		Viewmodel.LSleeve.Texture4,
		Viewmodel.LSleeve.Texture5,
		Viewmodel.LSleeve.Texture6,
		--Right Sleeve Textures
		Viewmodel.RSleeve.Texture,
		Viewmodel.RSleeve.Texture2,
		Viewmodel.RSleeve.Texture3,
		Viewmodel.RSleeve.Texture4,
		Viewmodel.RSleeve.Texture5,
		Viewmodel.RSleeve.Texture6,
		--Other Viewmodel Parts
		Viewmodel["Left Arm"],
		Viewmodel["Right Arm"],
	}
	
	for i, part in pairs(PartTable) do
		part.Transparency = 0
	end
end

RunService.RenderStepped:Connect(function(dt)
	local Viewmodel = Camera:FindFirstChild("Viewmodel")
	MainModule.update(Viewmodel, dt, RecoilSpring, BobbleSpring, SwayingSpring)
end)

EquipEvent.Event:Connect(ViewmodelWeld)

And below is the models
image

Title says it all, upon the weld being created it doesn’t move the weapon inside of the ViewModel.

I’m not the one to solve it, but I’ve seen other posts about the same topic.
I searched moving arms weapon viewmodel first person and got a few hits, one with a solution marked.

1 Like

It was as simple as making the Handle unachored, but now I fall through my baseplate part, fixed that too, Changed collision group of the baseplate back to Default

2 Likes

Don’t give me the Solution marking, just let others know how you fixed it and mark that post as your Solution.

1 Like

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