How to put a view model in a tool/ how to make viewmodel turn on when tool equip

hi, I need some help with my ViewModel. I am making an fps game with ViewModel and I need it to turn on the view model when a tool is equipped. I have a current script in starter character. any help with this

a local script in starter character -

local player = game.Players.LocalPlayer

local char = script.Parent

local cam = workspace.Camera

local run = game:GetService(“RunService”)

local arms = game.ReplicatedFirst.Arms:Clone()

local wdown = false

local sprinting = false

local shift = false

local uis = game:GetService(“UserInputService”)

run.RenderStepped:Connect(function()

arms:SetPrimaryPartCFrame(cam.CFrame * CFrame.new(0,0,0))

end)

arms.Parent = cam

run.RenderStepped:connect(function()

1 Like

try looking at this reply i made a while ago:

i have one problem with this, in output a error shows up, “Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.” but my viewmodel primarypart is set as the humanoidrootpart

i kinda found out the problem, whenever i put my viewmodel in workspace its falls and gets destoryed. i try to put it in replicatedstorage but that didnt work, but whenever anchor the viewmodel its works but the problem is that animation dont work and whenever u unequip. the viewmodel stays in the air