Unable to assign property CFrame. CoordinateFrame expected, got nil

Hello, so i’m making a game that has a local script in startergui that basically gives you a view of sometthing in the main menu, it worked before and i didn’t change anything in the script and now it randomly says:

“Unable to assign property CFrame. CoordinateFrame expected, got nil”

here’s the script:

local player = game.Players.LocalPlayer
local char = player.Character
local cc = workspace.CurrentCamera
local pc = game.Workspace:FindFirstChild("PlayCamera")
local dmc = game.Workspace:FindFirstChild("DMCamera")

local pb = script.Parent.MenuGui.PlayButton
local dmb = script.Parent.MenuGui.SettingsButton

wait(.00000001)

cc.CameraType = Enum.CameraType.Scriptable

cc.CFrame = p

local function playEntered()
	cc.CFrame = pc.CFrame
end

pb.MouseEnter:Connect(playEntered)

local function dmEntered()
	cc.CFrame = dmc.CFrame
end

dmb.MouseEnter:Connect(dmEntered)
1 Like

The line cc.CFrame = p might be the issue.
I can’t find any variable in the script named p. Check the variable names.

2 Likes

its suppost to be pc, i accidently deleted the c but it still worked before.

Definitely fix the variable name. Also, change all the FindFirstChild() function calls to WaitForChild(), because you need those items for the script to run.

If you change that, and you get something regarding “Infinite Yield”, check the variable names you are waiting for.

Yep. The document says that if it doesn’t show up, after 5 seconds it prints that warning.

after i ddi the “WaitForChild” i get " [Unable to assign property CFrame. CoordinateFrame expected, got isntance]"

1 Like

Just replace pc with pc.CFrame

Did you also change the variable name? Can you send an updated version of the script?

nvm i just did something wrong, this actually worked. thanks!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.