{ERROR}Position cannot assign to

I have searched this topic but didn’t found anything

so I was making a custom character controller and I wanted to change the cameras position to parts position but Its shows this error…
10:23:05.526 - Position cannot be assigned to

heres the script its not that much I was just testing first…

--28/10/20--

--Variables

--Services
local workSpace = game:GetService("Workspace") -- workSpace
local RunService = game:GetService("RunService") --RunService

--Instances
local player = workSpace:WaitForChild("player"); --player
local camera = workSpace.CurrentCamera; --camera

--Properties
camera.CameraType = Enum.CameraType.Scriptable; --so script can change it
RunService.RenderStepped:connect(function()
    camera.CFrame.Position = player.CFrame.Position;
end)

print(camera.CFrame.Position); --prints the position 
print(player.CFrame.Position); --prints the position.```

Thanks in advance😀(IDK everyone puts this at last).(why is this in script?)
2 Likes

Take out the Position part but leave the CFrame.

camera doesn’t have position property

1 Like
--28/10/20--

--Variables

--Services
local workSpace = game:GetService("Workspace") -- workSpace
local RunService = game:GetService("RunService") --RunService

--Instances
local player = workSpace:WaitForChild("player"); --player
local camera = workSpace.CurrentCamera; --camera

--Properties
camera.CameraType = Enum.CameraType.Scriptable; --so script can change it
RunService.RenderStepped:connect(function()
    camera.CFrame = player.CFrame
end)

print(camera.CFrame); --prints the position 
print(player.CFrame); --prints the position.

This is what I said.

The problem is the player is a ball so the movement is by rolling and CFrame comes with angles so the camera will go crazy…

Have you defined the player character correctly?

Yes
print(player.CFrame.Position); --prints the position. this prints its position in Vector3 too

Well no-ones replying anymore R.I.P. me ig.

You can create a new CFrame with only the position data like so:

camera.CFrame = CFrame.new(player.Position)

This will allow you to move the camera to the balls position.

You will need to do some extra work to rotate it to your needs though.

10 Likes