-
What do you want to achieve?
I’m currently trying to make a top-down view camera for my game. -
What is the issue?
For some reason, my character’s position goesnan
…??
Example Gif -
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 = CFrame.new(Vector3.new(Pos.X,16,Pos.Z),Pos)
end
Does anyone know why my character dies?
Does it have something to do with the run service maybe…??
Thanks for reading