Attempt to index nil with 'Humanoid'

I want to change the players Cameraoffset But I keep getting this error.

local character = player.Character or player.CharacterAdded:Wait()


This is what I got from using that

--//Services
local Players = game:GetService("Players")

--//Variables
local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character or LocalPlayer.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")

--//Functions
Humanoid.CameraOffset = Vector3.new(0, 0, -1)
1 Like