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)

4 comments
kk I changed it but it still doesn't work
No errors? I fixed your problem. If it's not doing what you wanted, it's because you're not doing anything except for waiting.
I want the part to always be in the center of the camera.
It is. You're never trying to move the focus or move the part away.