I wanted to make my camera up, like does 2D games. But when I used a part and changed the CameraSubject to it, the part couldn’t copy the players(Character) position, so I used instead the Camera in the Workspace but when I try assigning the position it doesn’t do its thing. Can someone help me?
local char:Model = script.Parent
local camera = workspace.Camera
local HIEGHTOFFSET = 6
local pos = {
[1] = char.PrimaryPart.Position.X, -- X
[2] = char.PrimaryPart.Position.Y*HIEGHTOFFSET, -- Y
[3] = char.PrimaryPart.Position.Z -- Z
}
-- Loop
while true do
camera.Focus.Position = Vector3.new(pos[1], pos[2], pos[3])
wait(0)
end
Error:
Position cannot be assigned to
I haven’t yet though do the camera positioning to be more like a 2D game but I will figure it out sooner or later…
local character = script.Parent
local camera = workspace.Camera
local HIEGHTOFFSET = 6
local pos = {
[1] = character .PrimaryPart.Position.X, -- X
[2] = character .PrimaryPart.Position.Y*HIEGHTOFFSET, -- Y
[3] = character .PrimaryPart.Position.Z -- Z
}
-- Loop
while true do
camera.Focus.Position = Vector3.new(pos[1], pos[2], pos[3])
wait(0)
end
local char:Model = script.Parent
local camera = workspace.Camera
local HIEGHTOFFSET = 6
local pos = {
[1] = char.PrimaryPart.Position.X, -- X
[2] = char.PrimaryPart.Position.Y*HIEGHTOFFSET, -- Y
[3] = char.PrimaryPart.Position.Z -- Z
}
-- Loop
while true do
camera.CFrame = CFrame.new(pos[1], pos[2], pos[3])
wait()
end
local character = script.Parent
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local HIEGHTOFFSET = 6
local pos = {
[1] = character.PrimaryPart.Position.X, -- X
[2] = character.PrimaryPart.Position.Y * HIEGHTOFFSET, -- Y
[3] = character.PrimaryPart.Position.Z -- Z
}
-- Loop
while true do
camera.Focus = CFrame.new(pos[1], pos[2], pos[3])
wait(0)
print("DS")
end
local char:Model = script.Parent
local camera = workspace.Camera
local HIEGHTOFFSET = 6
-- Loop
while true do
local pos = Vector3.new(char.PrimaryPart.Position.X,char.PrimaryPart.Position.Y*HIEGHTOFFSET,char.PrimaryPart.Position.Z)
camera.Focus = CFrame.new(pos)
wait()
end