Can anyone help me
--> ReplicatedStorage / Modules / Constructors
--> Services / Variables
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
local Modules = ReplicatedStorage:WaitForChild("Modules")
--> External Modules
local Util = require(Modules.Util)
--> Constructor
local Viewmodel = {}
Viewmodel.__index = Viewmodel
function Viewmodel.New(Name : string)
local self = {}
--> Init Model
self.Model = Util.GetViewmodel(Name)
self.Model.Parent = workspace.CurrentCamera
spawn(function()
Viewmodel:Update()
end)
return setmetatable(self, Viewmodel)
end
--> Update
function Viewmodel:Update()
self.Model:PivotTo(workspace.CurrentCamera.CFrame)
end
return Viewmodel
its fine for the first frame, then after that it says attempt to index nil with :PivotTo()