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
 

Re: Script not working in play, but is in solo? Look here!

Previous Thread :: Next Thread 
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 May 2014 07:35 PM
In play solo the client and server is the same thing. So the most common reason is that you're using the wrong type of script.


LocalScript <-> Script


Remember, game.Players.LocalPlayer only works in LocalScripts



Another common mistake is trying to use serversided code only in a LocalScript


A few example of things a LocalScript can't use;

DataStoreService

HttpService

PlayerAdded

LoadCharacter




So remember this next time your script works in solo but not in play.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:36 PM
Way too many enters.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 May 2014 07:36 PM
Another thing that only works in LocalScripts is GetMouse
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:36 PM
and the CurrentCamera property of workspace, and the AbsoluteSize/Position properties in GUI elements, and a lot more
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
27 May 2014 07:36 PM
@Cnt
This post == string.rep("\n", math.huge)


http://youtu.be/65Fi9tt6emI
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
27 May 2014 07:37 PM
Most LocalScripts will need "repeat wait() until games.Players.LocalPlayer" at the top if you define the player as the first thing.




You also have to yield for some children to load or something like that.
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 May 2014 07:37 PM
Exactly. So if your trying to access

LocalPlayer

CurrentCamera

GetMouse


Use a LocalScript
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:38 PM
lol 128G

string.rep("\n", 134217728)
I'm sure you'll get this
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
27 May 2014 07:38 PM
local player = game.Players:WaitForChild('LocalPlayer');

is much better than repeat wait() until blah blah imo.

Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:38 PM
You can't WaitForChild like that since LocalPlayer is a property.
Report Abuse
128GB is not online. 128GB
Joined: 17 Apr 2014
Total Posts: 8056
27 May 2014 07:39 PM
I get it ;3
Report Abuse
EchoReaper is not online. EchoReaper
Joined: 14 Oct 2008
Total Posts: 4323
27 May 2014 07:39 PM
Even if you could do that, Verified, your player is loaded before the PlayerGui and Backpack (only places local scripts can run), so why would you need to wait for it? e.e
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:40 PM
You usually want to wait for the Character in most cases (as Echo basically said)
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 May 2014 07:43 PM
"Even if you could do that, Verified, your player is loaded before the PlayerGui and Backpack (only places local scripts can run), so why would you need to wait for it? e.e"


That is incorrect. They also run in the players Character.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
27 May 2014 07:44 PM
But the backpack is added when the character first respawns, so yeah
Report Abuse
warspyking is not online. warspyking
Joined: 15 Nov 2011
Total Posts: 13947
27 May 2014 07:46 PM
I still had to point it out :P
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
27 May 2014 07:48 PM
Too bad they fixed server scripts enacted as local scripts inside a hopperbin.
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