|
| 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
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
|
| 27 May 2014 07:36 PM |
| Another thing that only works in LocalScripts is GetMouse |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 27 May 2014 07:37 PM |
Exactly. So if your trying to access
LocalPlayer
CurrentCamera
GetMouse
Use a LocalScript |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 17 Apr 2014 |
| Total Posts: 8056 |
|
| |
|
|
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 27 May 2014 07:46 PM |
| I still had to point it out :P |
|
|
| Report Abuse |
|
|
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 |
|
|