hey so my FPS handler isn’t attaching the root part to my gun.
function handler.weldGun(gun)
local Main = gun.MainComponents.Handle
for i, v in ipairs(gun:GetDescendants()) do
if v:IsA("BasePart") and v ~= Main then
local NewMotor = Instance.new("Motor6D")
NewMotor.Name = v.Name
NewMotor.Part0 = Main
NewMotor.Part1 = v
NewMotor.C0 = NewMotor.Part0.CFrame:inverse() * NewMotor.Part1.CFrame
NewMotor.Parent = Main
end
end
end
function handler.equip(viewmodel, gun)
local GunHandle = gun.MainComponents.Handle
local HRP_Motor6D = viewmodel:WaitForChild("HumanoidRootPart").Handle
gun.Parent = viewmodel
HRP_Motor6D.Part1 = GunHandle
end
return handler
ViewModel.Parent = game.Workspace.Camera
FPSModule.weldGun(GunModel)
FPSModule.equip(ViewModel, GunModel)
game:GetService("RunService").RenderStepped:Connect(function(dt)
FPSModule.update(ViewModel, dt)
end)
