Changing camera only working in studio and not in actual game

Well techincally its not “only working” in studio as it does work in game sometimes, although 90% of the time it just breaks and the camera script doesnt work

Heres the script, its in StarterPlayerScripts

repeat S = pcall(function() game:GetService("StarterGui"):SetCore("ResetButtonCallback", false) end) task.wait(0.1) until S 

-- Varibles
local Player = game:GetService("Players").LocalPlayer
local Players = game:GetService('Players')
local Camera = game.Workspace.CurrentCamera
local LobbyCam = game.Workspace.LobbyCam 
local MenuCam = game.Workspace.MenuCam
local CamChangeEvent = game.ReplicatedStorage.Events:WaitForChild("ChangeCamera")
local CamChangeSTLEvent = game.ReplicatedStorage.Events:WaitForChild("ChangeCam")

-- Functions
local function ChangeCam(Cam)
	if Cam == "Menu" then
		Camera.CFrame = MenuCam.CFrame
	end
	
	if Cam == "Lobby" then
		Camera.CFrame = LobbyCam.CFrame
	end
	
	if Cam == "Extras" then
		-- Soon(tm)
	end
end

-- Main
local Character = Player.Character or Player.CharacterAdded:Wait()
repeat Camera.CameraType = Enum.CameraType.Scriptable; task.wait(0.01) until Camera.CameraType == Enum.CameraType.Scriptable
ChangeCam("Menu")

CamChangeEvent.Event:Connect(ChangeCam)

script.Sound:Play()
script.Sound.Looped = true
1 Like