Character dies because of a top-down view camera script..?

  1. What do you want to achieve?
    I’m currently trying to make a top-down view camera for my game.

  2. What is the issue?
    For some reason, my character’s position goes nan…??
    Example Gif

  3. What solutions have you tried so far?
    I looked onto other scripts, and they seem to be almost no different except they don’t have a locked Y position for the camera. (The camera follows the player’s RootPart even on the Y axis, while my script doesn’t.)

I have absolutely 0 clue about why this happens…
I have no other scripts in this place other than a footstep sounds script which doesn’t temper with any positions.
This is my script:

--// Services //--
local RunService	=	game:GetService("RunService")
local Players		=	game:GetService("Players")

--// Variables //--

--// Main
local Player	=	Players.LocalPlayer
local Character	=	Player.Character
local RootPart	=	Character:WaitForChild("HumanoidRootPart")

--// Camera
local Camera		=	workspace.CurrentCamera
Camera.CameraType	=	Enum.CameraType.Scriptable

--// Functions //--
while RunService.RenderStepped:Wait() do
	local Pos = RootPart.Position
	Camera.CFrame =,16,Pos.Z),Pos)

Does anyone know why my character dies?
Does it have something to do with the run service maybe…??

Thanks for reading :slight_smile:

Change Camera.CFrame =,16,Pos.Z),Pos)

Camera.CFrame =,Pos.Y + 16,Pos.Z),Pos)

1 Like

I want it to stay on a single Y position, why does it bug out like that though?

im not sure, making it a fixed position for some reason just bugs out the player leading to death. That is the only solution i can think of.

Welp that’s unfortunate, thanks either way :slight_smile: