Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempt to index nil with 'CFrame'?

Asked by 1 year ago
Edited 1 year ago

** EDIT: I realized that I typed something wrong. **

I have this error on my Local Script ( Camera Script ) and it says attempt to index nil with 'CFrame'. Now the weird problem with this script is that I have the same function which does the same thing and there aren't any errors on that function.

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera
local cameras = workspace.cameras

local Rep = game:GetService("ReplicatedStorage")
local Rem = Rep.Remotes


function FrontDoorC(obj)
    repeat wait()
        Camera.CameraType = Enum.CameraType.Scriptable
    until Camera.CameraType == Enum.CameraType.Scriptable
    Camera.CFrame = obj.CFrame
end
function EndFrontDoorC()
    repeat wait()
        Camera.CameraType = Enum.CameraType.Custom
    until Camera.CameraType == Enum.CameraType.Custom
end 

function Scenes(obj)
    repeat wait()
        Camera.CameraType = Enum.CameraType.Scriptable
    until Camera.CameraType == Enum.CameraType.Scriptable
    Camera.CFrame = obj.CFrame
end
function End_Scene()
    repeat wait()
        Camera.CameraType = Enum.CameraType.Custom
    until Camera.CameraType == Enum.CameraType.Custom
end

Rem.FrontDoorC.OnClientEvent:Connect(FrontDoorC)
Rem.StopFrontDoorC.OnClientEvent:Connect(EndFrontDoorC)
Rem.Scene.OnClientEvent:Connect(Scenes)
Rem.End_Scene.OnClientEvent:Connect(Scenes)
1
Please show your script that uses :FireClient() thank you T3_MasterGamer 2189 — 1y
0
Please know that I said ** EDIT: I realized that I typed something wrong. **. Brioche_Noodle 45 — 1y
0
^ We still need to see the script calling :FireClient() blowup999 659 — 1y
0
I was getting this problem too on my camera script. I resorted to using an already made camera script. Any luck on fixing yours? KingDomas 153 — 1y

Answer this question