hello, so im making a game and I have it so that there is a main menu. That main menu has a camera part that the camera is perched onto. When I click “begin” to play the game, it comes up with this error: attempt to index nil with 'CFrame'
. I don’t know why this is happening. Please help!
local plr = game.Players.LocalPlayer
local PlayerMod = require(plr.PlayerScripts:WaitForChild("PlayerModule"))
local Controls = PlayerMod:GetControls()
--Variable for the current camera
local cc = workspace.CurrentCamera
script.Parent.MouseButton1Click:Connect(function()
plr.PlayerGui.MainMenu.Enabled = false
--Variable for the Camera you want for the menu
wait(0.001)
cc.CameraType = Enum.CameraType.Custom
cc.CFrame = plr.Character:FindFirstChild("Head").CFrame
game.Lighting:FindFirstChild("MainBlur").Enabled = false
Controls:Enable()
end)
error on line 12, where it says cc.CFrame = plr.Character:FindFirstChild("Head").CFrame