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 » Scripters
Home Search
 

Re: Why does this line work in studio but not in game:

Previous Thread :: Next Thread 
kentpent1234 is not online. kentpent1234
Joined: 29 Dec 2010
Total Posts: 220
24 Feb 2016 02:47 PM
game.Workspace.CurrentCamera.CameraType = "Track"

Any ideas?
Report Abuse
Daftcube is not online. Daftcube
Joined: 10 Jan 2010
Total Posts: 275
24 Feb 2016 02:49 PM
So! This is an interesting gotcha for anyone who hasn't worked with networking before!

In studio, this code runs on your local machine.

In game, it runs on the server. On the server, there is no such thing as a camera. Servers don't do that stuff!

If you want this code to work, put it in a local script. This causes the code to be executed on the user's machine, like in studio.
Report Abuse
kentpent1234 is not online. kentpent1234
Joined: 29 Dec 2010
Total Posts: 220
24 Feb 2016 02:51 PM
Thank you for trying to help but it is in a local script
Report Abuse
kentpent1234 is not online. kentpent1234
Joined: 29 Dec 2010
Total Posts: 220
25 Feb 2016 09:31 AM
Anyone?
Report Abuse
iondriver is not online. iondriver
Joined: 18 Nov 2012
Total Posts: 757
25 Feb 2016 09:34 AM
I am not sure. Are their any errors in the output?

Also, try: game.Workspace.CurrentCamera.CameraType = Enum.CameraType.Track
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
25 Feb 2016 11:15 AM
must be in a local script
Report Abuse
Casualist is not online. Casualist
Joined: 26 Jun 2014
Total Posts: 4443
25 Feb 2016 11:38 AM
while not workspace.CurrentCamera do wait() end;
local player = game:GetService("Players").LocalPlayer;
player:WaitForChild("PlayerScripts"):WaitForChild("CameraScript");
(player.Character or player.CharacterAdded:wait()):WaitForChild("Humanoid");
wait(); --// guarantee hand-off from this thread to CameraScript so that initial camera setup gets done before we change things


--//change things
workspace.CurrentCamera.CameraType = "Track"
Report Abuse
Daftcube is not online. Daftcube
Joined: 10 Jan 2010
Total Posts: 275
27 Feb 2016 01:56 PM
You could try

Workspace.CurrentCamera.CameraType = Enum.CameraType.Track
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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