Enum.CameraType.Custom not working

I’m making a menu screen when you enter the game, but when the player clicks the playbutton and I set the CameraType to custom, it doesn’t work, here a video of what I mean.

robloxapp-20201017-1241059.wmv (763.2 KB)

The character stands on the baseplate, but the camera is somewhere else. I use a localscript and a serverscript. This is the local script.

-- Services
local Players = game:GetService("Players")
local tweenService = game:GetService("TweenService")

local screenGui = script.Parent
local playButton = screenGui.PlayButton
local blackScreen = screenGui.BlackScreen

local camera = workspace.CurrentCamera

local player = Players.LocalPlayer

local remoteEvent = game.ReplicatedStorage.remoteEvents.mainmenuEvent

local Info = TweenInfo.new(
	2,
	Enum.EasingStyle.Linear,
	Enum.EasingDirection.In,
	0,
	false,
	0
)

blackScreen.Visible = true

remoteEvent.OnClientEvent:Connect(function(playing)
	print("yeah")
	if playing then
		wait()
		if camera.CameraType ~= Enum.CameraType.Scriptable then
			camera.CameraType = Enum.CameraType.Scriptable
			camera.CFrame = workspace.lookpart.CFrame
		end

		print("seeing playbutton")
		playButton.Visible = true
		blackScreen.BackgroundTransparency = 1


		playButton.MouseButton1Click:Connect(function()
			blackScreen.Visible = true
			blackScreen.BackgroundTransparency = 1

			local tween = tweenService:Create(blackScreen, Info, {BackgroundTransparency = 0})
			tween:Play()
			tween.Completed:Wait()

			remoteEvent:FireServer()
		end)
	else
		print("tweening")
		blackScreen.BackgroundTransparency = 0
		blackScreen.Visible = true
		local tween = tweenService:Create(blackScreen, Info, {BackgroundTransparency = 1})
		tween:Play()
		camera.CameraType = Enum.CameraType.Custom
		tween.Completed:Wait()
		
		blackScreen.Visible = false
		playButton.Visible = false
	end
end)

here is the serverscript

-- Services
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local remoteEvent = ReplicatedStorage.remoteEvents.mainmenuEvent

local camera = workspace.CurrentCamera


Players.PlayerAdded:Connect(function(player)
	player.RespawnLocation = workspace.SpawnLocation
	player.CharacterAdded:Connect(function()
		print("character added")
	end)
	wait()
	remoteEvent:FireClient(player, true)
end)

remoteEvent.OnServerEvent:Connect(function(player)
	player.RespawnLocation = workspace.realspawn
	player:LoadCharacter()
	print("loaded character")
	remoteEvent:FireClient(player, false)
end)

I would be happy if someone could help me with this.

Did you change the camerasubject and when you teleport the player did you use CFrame instead of position(the CFrame question is kinda random but it could be the problem)

I had a problem like this once, when you play can you check where the humanoidrootpart is

I didn’t change the camerasubject once. I don’t teleport the player. I change its respawnpoint and then I load the character.

When I play and go into server mode, I see the character on top of the baseplate

instead of camera.CameraType = Enum.CameraType.Scriptable

try

camera.CameraType = “Scriptable”

do it with the others aswell

That didn’t work as well (limit)

I found a solution: setting the camerasubject to the player’s humanoid, but I still don’t know why it did not work in the first place.