The question is in the title , is there any ways to get the camera’s position?
no i mean the position not the cframe because im making a load character plugin and when it spawn a npc , the npc is tilted
Adding onto this, the solely positional Vector3 component can be found with:
game:GetService("Workspace").CurrentCamera.CFrame.Position
ima try but why game:GetService(“Workspace”) lol you can use game.workspace
it worked but it didnt earlier wth
I use GetService as it is the canonical way of getting services, because it searches via class name rather than name and initiates services that have not already been initiated. Using the DataModel.Workspace
property or workspace
global is the only in case in which the function is not useful, but I use it regardless to remain consistent with the rest of my service-getting shenanigans.
There’s no point in using GetService() to reference workspace when “workspace” is already built into the scope. It’s slower too. (edit: this was confirmed by my common sense and fireboltofdeath’s research)
e.g. workspace.CurrentCamera.CFrame.Position
In my personal tests, GetService is slower than game.Workspace, but game.Workspace is slower than the global variable workspace.
@IF0rst
If Dandystan’s solution worked, you should mark his post as the solution.
workspace is a global variable that references the Workspace. game.Workspace accesses the property of the DataModel, Workspace, which points to the Workspace. Workspace is a service. The canonical method of fetching a service is through GetService. The other two are syntactic sugar and alternate methods of retrieving the Workspace.
It’s comfortable for some developers to use these over GetService on the Workspace, but in cases where you want to maintain a specific style guide, organisation or convention, GetService would fall in line with the rest of your service variables.
The speed it takes to fetch the Workspace either three ways is something negligible and should be ignored. They only differ from each other by a thin marginal amount.
Make sure you are using a local script for this. workspace.CurrentCamera.CFrame.Position should work.
How can i do that though? --------------------
This checkbox on his post.