I wanted to learn how to make fps framework but i got this error can someoen help me??
The script--
repeat
wait()
until game:IsLoaded()
local plr = game.Players.LocalPlayer
local char = plr.Character
local mouse = plr:GetMouse()
local cam = workspace.CurrentCamera
local Run = game:GetService("RunService")
local RS = game.ReplicatedStorage
local GunModules = RS:WaitForChild("GunModules")
local GunModels = RS:WaitForChild("GunModels")
local Primary = "AK74"
local WeaponInHand
local WeaponData
local maincf = CFrame.new()
plr.CameraMode = Enum.CameraMode.LockFirstPerson
Run.RenderStepped:Connect(function()
if WeaponInHand then
WeaponInHand:SetPrimaryPartCFrame(
cam.CFrame
* maincf -- The error is here
)
end
end)
function setup(weapon)
WeaponData = require(GunModules:WaitForChild(weapon))
maincf = WeaponData
WeaponInHand = GunModels:WaitForChild(weapon)
WeaponInHand.PrimaryPart = WeaponInHand:WaitForChild("Handle")
WeaponInHand.Parent = cam
for i, part in pairs(WeaponInHand:GetChildren()) do
if part:IsA("BasePart") then
part.Anchored = true
part.CanCollide = false
end
end
end
setup(Primary)
