ViewportFrame.Changed returning property "CameraCFrame" which does not exist?

  1. What do you want to achieve?

I need to be able to use the .Changed event of ViewportFrame without it returning non-existent properties.

  1. What is the issue?

I am using viewport frames with rotating cameras to display models in a UI I am working on.


And the .Changed event keeps returning a property of ViewportFrame called “CameraCFrame”

Which as shown in this error, apparently does not exist.

  1. What solutions have you tried so far?

I’ve tried using a simple if statement to dismiss any properties that don’t exist.

	if ViewportFrame[Property] then

But it seems that any attempt to run ViewportFrame[Property] while Property = “CameraCFrame” will throw the same error shown above.

I was tempted to just call this a glitch on Roblox’s side, but I wanted to consult with scripting support just in case I’m getting something wrong here.

This seems like unexpected behaviour for sure. I suggest filing a bug report in #platform-feedback:engine-bugs.

In the meantime, you have a few options.

  1. You can use :GetPropertyChangedSignal(PROPERTY_NAME) to listen for specific property value changes.

  2. You can pcall your property check before using it. Note that this isn’t necessarily the most efficient method of doing this.

    local success = pcall(function()
        return viewportFrame[property]
    if success then
        print(property .. " is a valid property")
        -- pcall errored, property is nil

I’m on mobile sorry for bad formatting or any issues with the example there.

1 Like

Thanks for such a quick reply. I’ll go file a report as suggested.

a[b] still throws an exception because you cannot index for a non-existent property at all. You can make a function that determines if a property exists.

Also I think it was @Maximum_ADHD who said a couple years ago that the Instance.Changed event leaked some internal property names in an old post I cannot find anymore. It could just be a bug though too.

local function has_property(instance, property)
    local has_property, data = pcall(function()
        return instance[property]
    return has_property and not instance:FindFirstChild(property) and typeof(data) ~= "RBXScriptSignal" and typeof(data) ~= "function"