Cannot get camera to stay fixed above map

Hello! I am developing an FPS set in WW1, and I am making the starting UI at the moment. When the player joins, I want them to see this UI, but have a blurred view of the map from the top down behind the GUI. I have this scripted, and I cannot figure out how to get it to work, as when my character spawns, the camera is just set to my character.

My code:

local camera = game.Workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable

camera.CFrame = game.ReplicatedStorage.SkyView.Value

This does not work. Would I have to put this in a CharacterAdded event instead?

Edit: game.ReplicatedStorage.SkyView is a CFrameValue with a value of the camera’s CFrame pointing down at the map below.

If your localscript is placed inside of a ScreenGui, make sure that the “ResetOnSpawn” property is set to false of the screengui.

You could also add a wait at the top of the script that waits until the character is loaded in before moving the camera.

Hope this helps!

You can either use CharacterAdded or just put the LocalScript into StarterCharacterScripts.

local replicated = game:GetService("ReplicatedStorage")
local skyview = replicated:WaitForChild("SkyView")

local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = skyview.Value

Should be as simple as a local script inside the StarterCharacterScripts folder, providing the “SkyView” instance is indeed a “CFrameValue” instance and its “Value” property correctly stores/holds a CFrame value.

I did that, but it just set the camera back on my avatar.

Is there some other script(s) manipulating the camera? The camera type “Scriptable” restricts all camera manipulation to scripts only.

No, this script is the only one messing with the camera.

This could have something to do with Roblox setting the camera because the player loaded, try waiting a bit before changing the camera CFrame.

Is the character’s humanoid instance dying at all? Whenever a character dies their camera is destroyed and then recreated upon them being reloaded.

local replicated = game:GetService("ReplicatedStorage")
local skyview = replicated:WaitForChild("SkyView")

local camera = workspace.CurrentCamera
repeat
	task.wait()
	camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable
camera.CFrame = skyview.Value

Waiting for the camera type to change may do the trick.

1 Like

I will try this. Sorry for the late response. I just now checked the forum.