1
\$\begingroup\$

I have created a very simple script to set up a fixed camera with no subject. In other words, I want a camera in a static position looking down at the world (a top-down style camera that doesn't follow anything), but regardless of what I do, the camera always attaches to a "Humanoid".

Is there a way to prevent this?

For reference, here is my script, which I name CameraScript and place in the StarterPlayerScripts group:

local cameraHeight = 150

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer

repeat
        wait()
until player.Character


local function setupCamera()    
    camera.CameraType = Enum.CameraType.Fixed
    camera.CameraSubject = nil
    camera.CFrame = CFrame.new(Vector3.new(0,cameraHeight,0), Vector3.new(0,0,0))
    print(tostring(camera.CameraSubject))       
end

setupCamera()
\$\endgroup\$
1
  • \$\begingroup\$ For reference, the output of the print method in the setupCamera method is "Humanoid". \$\endgroup\$
    – vargonian
    Commented Jul 19, 2017 at 0:46

2 Answers 2

0
\$\begingroup\$

Your script errors on the line:

repeat
        wait()
until player.Character

With ., it gives an error when trying to access nil, however FindFirstChild simply returns nil. Try:

repeat
        wait()
until player:FindFirstChild("Character")
\$\endgroup\$
-2
\$\begingroup\$

create a part above said world and have a camera fixed on it, make it transparent though

\$\endgroup\$
1
  • \$\begingroup\$ Hi and welcome to GameDev SE! I notice your answer has gotten a down vote - don't worry, those happen from time to time and they're easy to bounce back from. Users will often upvote detailed answers, so if you edit this answer to include more information about the steps to take, you'll likely see its score improve. :) \$\endgroup\$
    – DMGregory
    Commented Nov 9, 2017 at 1:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .