I know that you can retrieve the CurrentCamera from a LocalScript by doing this:
local camera = game.Workspace.CurrentCamera
However, I want to be able to get the CurrentCamera in a normal Script, specifically for one that is in StarterPlayer > StarterCharacterScripts.
I have tried using a RemoteFunction to retrieve it. This is the method that I used:
-- This is inside a normal Script in ServerScriptService
game.Players.PlayerAdded:connect(function(player)
local getCamera = script:WaitForChild("GetCamera"):Clone() --Already created RemoteFunction
getCamera.Parent = player
getCamera:WaitForChild("LocalScript").Disabled = false --Script inside RemoteFunction
end)
-- This is what's inside the LocalScript in the RemoteFunction (separate script)
function script.Parent.OnClientInvoke()
print("Getting camera...") --> Doesn't print anything when invoked
return game.Workspace.CurrentCamera
end
-- This is inside a normal Script in StarterCharacterScripts (separate script)
local player = game.Players:GetPlayerFromCharacter(script.Parent)
print(player:FindFirstChild("GetCamera") ~= nil) --> prints true (so it exists!)
local camera = player:FindFirstChild("GetCamera"):InvokeClient(player)
print("Retrieved camera") --> doesn't print anything; rest of the script doesn't execute
So it is apparent that when I invoke the client to retrieve the CurrentCamera, it yields the script right there. It doesn't even give any errors or anything. The script just pauses there. Is it possible to retrieve CurrentCamera from a normal Script at all, or am I doing something wrong in my method?

2 comments
Oh, I knew that. I have no idea why I wrote "LocalCamera" instead of "CurrentCamera". I fixed it. Anyways, thanks for the response.
if u do workspace.CurrentCamera in a normal script though, it returns the SERVER'S camera which you probably dont need