CurrentCamera Script is doing basically nothing

The intention of the script is to change the CurrentCamera’s CameraType and CameraSubject, when the player joins.

It prints that it changed, but it doesn’t change the CameraSubject for my player, probably the CameraType too.

game.Players.PlayerAdded:Connect(function()
	local camera = workspace.CurrentCamera
	camera.CameraType = Enum.CameraType.Scriptable
	print(camera.CameraType)
	camera.CameraSubject = workspace.OpeningSceneCamera
	print(camera.CameraSubject)
end)

Is this a Script or a LocalScript, where are you putting it in?

1 Like

It’s a Script in ServerScriptService

you should put it in a local script inside starter player scripts

1 Like

I think game.PlayerAdded, doesn’t work client sided. Now it doesn’t print/fire.

You should put it in a LocalScript in StarterPlayerScripts which would be under the StarterPlayer Service.

This will put it in every player that joins, so you dont need that PlayerAdded event. Instead you could reference the player with game.Players.LocalPlayer

image

Use a LocalScript, then put it in StarterPlayerScripts, then write:

local Players = game:GetService("Players")
local Camera = workspace.CurrentCamera
local OpeningPart = workspace.OpeningSceneCamera

Players.PlayerAdded:Connect(function()
     Camera.CameraType = Enum.CameraType.Scriptable
     Camera.CFrame = OpeningPart.CFrame
end)

This… should work, haven’t tried it. Let me know if you’re experiencing any issues.

It changed it now by now it’s, um, I think in the void? I from some people, I heard that changing it locally may do this.

I see this sometimes happen with some of my camera stuff so I usually do this

repeat wait()
    camera.CameraType = Enum.CameraType.Scriptable
until camera.CameraType == Enum.CameraType.Scriptable

That might be your camera’s CFrame, try printing the position of the camera.

Is the part your setting the CFrame to anchored?

Do you want the Camera to move? If so, change the CameraType.

Yes, I just checked and it is. --I need to type more to be able to post this

It could also be the LookVector of your camera, it might be facing the sky. Try setting the camera’s CFrame to CFrame.new(OpeningPart.Position, Vector3.new(0,-1,0)) unless it isnt broken. Then adjust it so it looks the proper direction.

I don’t think that could happen since I have it in a roofed area.

Does it only work when you spawn as a player? That is supposed to happen since you are using client scripts only.

Yes, the camera subject only changed when I spawned the Roblox default module script also ceased action

If you want it to work on the server aswell then use the same script except clone it to the server instead, and make it just a normal “Script” instance.

Yea, now I am a bit confused, I have the same script in my script now, but it seems Roblox’s script is overriding it now?

Yeah I tested it and it seems you can move while the camera is being manipulated on the server, I dont think there is anything you can do unless you can adjust the camera moving.