local cam=game.Workspace.CurrentCamera local play=game.Workspace.Build.Play.Play cam.CameraSubject=game.Workspace.Build.Play.Play cam.CameraType="Scriptable" cam.FieldOfView=30 cam.Focus=CFrame(play.CFrame) play.ClickDetector.MouseClick:connect(function() for i=1, 55 do cam.Focus=CFrame(play.CFrame) wait(0.1) end end)
I am trying to make a script where the player has no access over their camera at all. The camera focuses on a brick called Play, location inside game.Workspace.Build.Play. The brick moves around 55 times when clicked, and then deleted itself. The Character is also deleted when it loads. However when I run this script it returns this error:
Here is the Error:
11:52:44.956 - Players.Player.Backpack.CameraScript:6: attempt to call global 'CFrame' (a table value)
11:52:44.957 - Stack Begin
11:52:44.958 - Script 'Players.Player.Backpack.CameraScript', Line 6
11:52:44.959 - Stack End
I don't know what a table value is, can someone explain the problem to me please?
However, after I removed the CFrame before the (play.Frame) it does not give any errors but still does not work. Anyone help? The script Now:
local cam=game.Workspace.CurrentCamera local play=game.Workspace.Build.Play.Play cam.CameraSubject=game.Workspace.Build.Play.Play cam.CameraType="Scriptable" cam.FieldOfView=30 cam.Focus=(play.CFrame) play.ClickDetector.MouseClick:connect(function() for i=1, 55 do cam.Focus=(play.CFrame) wait(0.1) end end)
CFrames are already CFrames
Also there's no typecasting like that
You don't need to construct a new CFrame from an existing CFrame value. For that reason, you can get rid of the CFrame(...)
bits. The constructor for a CFrame is also CFrame.new
rather than CFrame
local cam=game.Workspace.CurrentCamera local play=game.Workspace.Build.Play.Play cam.CameraSubject=game.Workspace.Build.Play.Play cam.CameraType="Scriptable" cam.FieldOfView=30 cam.Focus=play.CFrame play.ClickDetector.MouseClick:connect(function() for i=1, 55 do cam.Focus=play.CFrame -- I'm also convinced that this doesn't do what you want it to. wait(0.1) end end)