I have a script as follows:
local HEIGHT = 20
local ANGLE = -90
local ROTATION = -90
local player = game.Players.LocalPlayer;
local runservice = game:GetService("RunService");
local function CameraUpdate()
if game.ReplicatedStorage.TankSpawned:InvokeServer() then
local character = player.Character;
local camera = workspace.CurrentCamera;
camera.CameraType = Enum.CameraType.Scriptable
local Tank = game.ReplicatedStorage.GetClientTank:InvokeServer()
game.Workspace.CurrentCamera.Focus = Tank.CFrame
camera.CoordinateFrame = CFrame.new(Tank.Position) * CFrame.Angles(0, math.rad(ROTATION), 0) * CFrame.Angles(math.rad(ANGLE), 0, 0) * CFrame.new(0, 0, HEIGHT);
end
end
runservice:BindToRenderStep("VertCamera", Enum.RenderPriority.Camera.Value, CameraUpdate);
This script works flawlessly in studio, though in-game it lags like crazy. It pretty much teleports the camera right to the player, every milisecond (not fast enough).
If I set the CameraSubject to "Tank", it works flawlessly in studio (again), but in game it doesn't have that nice straight-down camera. It is slightly off center, though it doesn't lag.
