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 » Game Design
Home Search
 

Re: Script not working online

Previous Thread :: Next Thread 
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
27 Mar 2015 10:32 PM
Works in solo but not online

local player = game.Players.LocalPlayer
local cam = game.Workspace.CurrentCamera
local body = player.Character

while true do
wait()
cam.Focus = CFrame.new(body.Torso.Position)
cam.CoordinateFrame = CFrame.new(body.Torso.Position) + Vector3.new(50,50,50)
cam.CameraType = Enum.CameraType.Watch
cam.FieldOfView = 15
end
Report Abuse
DerpyMerpKing is not online. DerpyMerpKing
Joined: 05 Feb 2011
Total Posts: 2553
27 Mar 2015 11:02 PM
idk
Report Abuse
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
28 Mar 2015 12:42 PM
wow thanks for your help!
Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
28 Mar 2015 12:44 PM
Some code breaks online if it's not in a LocalScript, and I think this is one of those cases. It will work as a normal script in Solo because the game is loaded differently then, but in online if you want to use .LocalPlayer, it needs to be inside a LocalScript.
Report Abuse
championbuilder is not online. championbuilder
Joined: 20 Jan 2009
Total Posts: 13544
28 Mar 2015 12:57 PM
Whats the output, that's ye hiden treasure to finding thee solution.
Report Abuse
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
28 Mar 2015 08:30 PM
19:29:06.439 - Use the new http api: no
Loading Cutscene Editor...
IsFirstUse = false
false
UseOldUI = true
true
19:29:12.079 - ! Joining game '' place 0 at localhost
19:29:12.080 - Connecting to ##############
Cutscene Editor19:29:06.439 - Use the new http api: no
Loading Cutscene Editor...
IsFirstUse = false
false
UseOldUI = true
true
19:29:12.079 - ! Joining game '' place 0 at localhost
19:29:12.080 - Connecting to ##############
Cutscene Editor Loaded
19:29:21.847 - Connection accepted from ############## Loaded
19:29:21.847 - Connection accepted from ##############
Report Abuse
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
28 Mar 2015 08:33 PM
OOps

Cutscene Editor Loaded
19:32:23.599 - Players.Player1.Backpack.LocalScript:7: attempt to index local 'body' (a nil value)
19:32:23.599 - Stack Begin
19:32:23.600 - Script 'Players.Player1.Backpack.LocalScript', Line 7
19:32:23.600 - Stack End
Report Abuse
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
28 Mar 2015 10:42 PM
Bmp
Report Abuse
Exsius is not online. Exsius
Joined: 11 Jan 2010
Total Posts: 6340
29 Mar 2015 02:03 AM
:(
Report Abuse
Exine is not online. Exine
Joined: 01 Apr 2013
Total Posts: 3783
29 Mar 2015 02:14 AM
Check the developer console
Report Abuse
drew8732 is not online. drew8732
Joined: 01 Apr 2010
Total Posts: 1965
02 Apr 2015 05:33 PM
Did you try putting your code in a LocalScript? That could be the reason that nothing at all is happening, but whether or not your script is done right is another problem.
Report Abuse
TheTroller4ever is not online. TheTroller4ever
Joined: 15 Apr 2013
Total Posts: 95
02 Apr 2015 05:43 PM
attempt to index local 'body' (a nil value)

The problem is that the character of the player hasn't loaded yet, therefore returns nil.
repeat wait() until player.Character

or put a wait(1) at the top of the script and it should be fine.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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