Can't change CFrame

Just to clarify, the code perfectly works, there’s just a problem with the actual code text.

So I’m trying to use TweenService to make a camera smoothly go to any position I want. The code works, but the “CFrame” is not what I expected.

TS:Create(camera,TweenInfo.new(2,Enum.EasingStyle.Exponential),{CFrame = instance.CFrame}):Play()

The code works perfectly as intended, but when I type CFrame alone, the script highlights it blue, because it thinks you’re trying to use CFrame.new or something, but I’m trying to define the property I want to tween in the camera.

If you have any suggestions or solutions, please comment them down. Thank you.

1 Like

This is because the code thinks you are trying to create instance.new. Change the instance variable to something else.

1 Like

Just ignore it, it’s studio’s highlighter acting goofy

2 Likes

So nothing happens? I just leave it?
What about the red underline that appears, even if it works, it drives me insane seeing it.

1 Like

If it is driving you crazy, then try changing the Instance variable to something else like I’ve said.

1 Like

The instance variable is lowercase so it should not pose an issue.

1 Like

Bro it’s nothing with the instance variable since it’s lowercase and won’t conflict with default Instance

1 Like

But I have to tween the CFrame property, I can’t just “change it”.

1 Like

I know, Studio acts weird because it thinks you typed it wrong.

1 Like

So for my code, do I just do “cframe”?

1 Like

This isn’t true roblox studio does not act weird

1 Like

It’s an issue us all scripters if you are editing in Roblox studio editor, for eg iirc it also happens for typing which is annoying beyound belief to see my types being colored like a rainbow

1 Like


The CFrame highlights blue, but there really is no issues?

1 Like

That wouldn’t work afaik and will prolly throw an error. Seems you like you just have to ignore it for now, but you can always edit the code in VS Code using plugins like ROJO

1 Like

It threw no errors and it worked. Nevermind then.

1 Like

No the way studio’s editor works is that it highlights certain datatypes (CFrame, string, UDim, UDim2, Vector3, Vector2, Instance, table). These are reserved keywords meaning that developers shouldn’t really name their variables this. However it’s impossible to not use it in some cases like yours.

It won’t throw any errors dw

1 Like

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