generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

How do I access the CurrentCamera from...

Previous Thread :: Next Thread 
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
20 Aug 2013 11:01 AM
How can I assess the current camera from someone, in a regular script?
Report Abuse
Newtrat is not online. Newtrat
Joined: 13 Jun 2011
Total Posts: 196
20 Aug 2013 11:02 AM
From the wiki: "Camera objects exist only upon the viewer's client, residing in that user's local Workspace, and therefore cannot be edited directly from the server. As of the most recent versions of the game, the only way to access a client's Camera object is through a LocalScript running on that client."

So as far as I know, you can't.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
20 Aug 2013 11:03 AM
Very Simple ... You don't. Unless you use _G.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
20 Aug 2013 11:04 AM
How can I assess the current camera if the local script is in workspace?
Report Abuse
Newtrat is not online. Newtrat
Joined: 13 Jun 2011
Total Posts: 196
20 Aug 2013 11:05 AM
Soquick, I don't know that _G would work, either, since clients see a different version of _G from what the server sees. So, if you store the camera in _G in a client, the server still won't be able to access it.

I was thinking you might be able to pass a reference to the local camera by putting it in an ObjectValue, but I'm not sure whether attempting to reference that object on the server would actually work. It sounds like the camera object only exists on the client
Report Abuse
mylifeis2cooldlol is not online. mylifeis2cooldlol
Joined: 08 Mar 2011
Total Posts: 874
20 Aug 2013 11:05 AM
A localscript can't run in the workspace unless it is under a character model (that is a character from a player)
Report Abuse
Newtrat is not online. Newtrat
Joined: 13 Jun 2011
Total Posts: 196
20 Aug 2013 11:06 AM
If it's a local script in workspace (or anywhere else), then you can just use Workspace.CurrentCamera.
Report Abuse
Newtrat is not online. Newtrat
Joined: 13 Jun 2011
Total Posts: 196
20 Aug 2013 11:07 AM
Ah, yeah, good point. OK, a local script running anywhere can use Workspace.CurrentCamera, but there are only a few places LocalScripts can actually run, and I'm pretty sure they're listed on the wiki page for LocalScripts.
Report Abuse
kingmatt2 is not online. kingmatt2
Joined: 20 Aug 2011
Total Posts: 6494
20 Aug 2013 11:09 AM
If I put
Workspace.CurrentCamera:Destroy()
Would that remove all the cameras? Or..? Im confuesd....
Report Abuse
Newtrat is not online. Newtrat
Joined: 13 Jun 2011
Total Posts: 196
20 Aug 2013 11:21 AM
I'm not actually sure what would happen if you tried to destroy the camera. I assume it would be immediately replaced by another camera, if it worked at all.

But in any event this would only work on the camera for the player whose client this code is running on.
Report Abuse
Soquick is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
20 Aug 2013 11:31 PM
Removing the camera will change camera pos to 0,0,0 I think but reseting fixes it
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
20 Aug 2013 11:35 PM
Newtrat said it: store the camera in an object valuw
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image