✓ Accepted answer
There are a couple of things here:
- Your script needs to be a LocalScript in order to access CurrentCamera
- In order for the LocalScript to run it needs to be in one of these places
- You can either :Clone() the script into the Player's PlayerGui or put the script in game > StarterPlayer > StarterPlayerScripts
Cloning method:
Script:
game.Players.PlayerAdded:connect(function(player)
local camScript = script.LocalScript:Clone();
camScript.Parent = player.PlayerGui;
camScript.Disabled = false;
end);
LocalScript (A child of the Script, this is disabled):
local pcam = game.Workspace.CurrentCamera
pcam.CameraSubject = game.Workspace.CameraFocus;
wait();
pcam.CameraType = Enum.CameraType.Scriptable;
pcam.CFrame = game.Workspace.CameraFocus.CFrame;
print("done");
The other method is much simpler for this camera script. You would simply put the script into StarterPlayerScripts inside of StarterPlayer
I hope this helped! If it did please accept this as the answer so people know it has been solved and you have been helped. If you have any questions feel free to ask. If you have any other non-related questions feel free to ask those too.
3 comments
Is this a script or a local script?
This is a script
Okay. Hang on