So I’m making a gun system and I’m setting up the viewmodel but when I equip the gun the viewmodel appears in some random place in the workspace instead of in the players camera
anyone know why?
function Gun:Equip()
print("Gun equipped!")
self.ViewModel = game.ReplicatedStorage.Viewmodel:Clone()
self.GunModel = game.ReplicatedStorage.AK74:Clone()
self.GunModel.Parent = self.ViewModel
self.ViewModel.Parent = workspace.Camera
local IsFirstPerson = self:CheckFirstPerson()
if self.ViewModel:FindFirstChild("HumanoidRootPart") then
self.ViewModel.PrimaryPart.CFrame = camera.CFrame
print("ViewModel's HumanoidRootPart CFrame set to Camera's CFrame")
else
warn("HumanoidRootPart not found in ViewModel!")
end
Gun.Equipped = true
end