Camera Changing Won't Work

When this code is executed, it works until it gets to the line where the CameraType is to be changed. It does not do anything and it just stops. No yields and no errors. This local script is under StarterPlayerScripts. I tried numerous solutions such as putting a wait(1). Does not work still. Any help will be greatly appreciated.

local cam = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Intermission_RoundValue = ReplicatedStorage.Intermission_RoundValue

if player.Team == game:GetService("Teams").Seeker then
	player.Character:WaitForChild("HumanoidRootPart").Anchored = true
	cam.CameraType = Enum.CameraType.Fixed
	player.CameraMaxZoomDistance = 20
	Intermission_RoundValue.Changed:Connect(function()
		if Intermission_RoundValue.Value ~= "Hiders, go hide!" then
			player.Character:WaitForChild("HumanoidRootPart").Anchored = false
			player.CameraMaxZoomDistance = 128
		end
	end)
end

That conditional statement:

if player.Team == game:GetService("Teams").Seeker then

Is only going to be executed once when the script first executes.

local players = game:GetService("Players")
local localPlayer = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local hrp = character:WaitForChild("HumanoidRootPart")
local camera = workspace.CurrentCamera

local rs = game:GetService("ReplicatedStorage")
local roundValue = rs:WaitForChild("Intermission_RoundValue")

local teams = game:GetService("Teams")
local seekers = teams:WaitForChild("Seeker")

local connection

seekers.PlayerAdded:Connect(function(player)
	if connection then
		return
	end
	
	if localPlayer == player then
		hrp.Anchored = true
		camera.CameraType = Enum.CameraType.Fixed
		player.CameraMaxZoomDistance = 20
		
		connection = roundValue.Changed:Connect(function(newValue)
			if newValue ~= "Hiders, go hide!" then
				hrp.Anchored = false
				player.CameraMaxZoomDistance = 128
				camera.CameraType = Enum.CameraType.Custom
				connection:Disconnect()
				connection = nil
			end
		end)
	end
end)
1 Like

Thanks, Forummer. You are very helpful on this forum.