NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 02 Jul 2015 10:05 PM |
So, When I run this script, I keep getting the same error
for i = 1, #g do if g[i]:IsA("Player") then g[i]:LoadCharacter() end end
error: LoadCharacter can only be called by the back end server
it's a normal script in workspace
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 02 Jul 2015 10:07 PM |
oops forgot to add in the part where it defines g
g = game.Players:GetChildren()
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 11:19 AM |
bump
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 11:31 AM |
for _,plr in next, game.Players:GetPlayers() do v:LoadCharacter() end |
|
|
| Report Abuse |
|
|
| |
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:06 PM |
@Abstract is v defined as game.Players:GetChildren()?
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
| |
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:10 PM |
thanks
~PM me for really r=are pepes~ |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 03 Jul 2015 05:10 PM |
im here for the rare pepes
robo is love robo is life ( ͡° ͜ʖ ͡°) |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:12 PM |
getting the same error: LoadCharacter can only be called by the backend server
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
robomax11
|
  |
| Joined: 07 Jul 2011 |
| Total Posts: 6828 |
|
|
| 03 Jul 2015 05:14 PM |
serverscript
serverscriptstorage
robo is love robo is life ( ͡° ͜ʖ ͡°) |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:16 PM |
The script in serverStorage?
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 03 Jul 2015 05:17 PM |
for i,v in next, game.Players:GetPlayers() repeat wait() v:LoadCharacter() until nil end |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:20 PM |
repeat errors
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 03 Jul 2015 05:20 PM |
| It was a troll post. Sorry, I'll be on my way. Good day to you sir. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 05:22 PM |
for _,p in pairs(game.Players:GetChildren()) do p:LoadCharacter() end
--Can only be done in a serverside script
~ Darkelementallord |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 05:23 PM |
@TimeTicks
This would be better:
for _,p in pairs(game.Players:GetChildren()) do coroutine.wrap(function() while wait() do p:LoadCharacter() end end)() end
~ Darkelementallord |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 05:32 PM |
Server-Script in ServerScriptService (or workspace, but use SSS):
local function LoadAllCharacters() for i, v in next, game.Players:GetPlayers() do spawn(function() v:LoadCharacter() end) end end
LoadAllCharacters()
Now, let's say you want to call this FROM THE CLIENT.
LocalScript in StarterPack:
RE = game.ReplicatedStorage:WaitForChild("RE")
--Whenever you want it to fire. RE:FireServer()
Server-Script in ServerScriptService:
local RE = Instance.new("RemoteEvent", game.ReplicatedStorage) RE.Name = "RE"
RE.OnServerEvent:connect(function() for i, v in next, game.Players:GetPlayers() do spawn(function() v:LoadCharacter() end) end end) |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:32 PM |
How would I run a script, from a script?
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
NotSoNorm
|
  |
| Joined: 01 Sep 2009 |
| Total Posts: 116 |
|
|
| 03 Jul 2015 05:33 PM |
oops didn't refresh nvm
~PM me for really rare pepes~ |
|
|
| Report Abuse |
|
|
AnimeWiki
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 460 |
|
|
| 03 Jul 2015 05:35 PM |
@power
spawn really why not pcall ? |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 05:35 PM |
A script from a script?
BindableEvents/Functions.
But needn't not use that. Just use what I did. |
|
|
| Report Abuse |
|
|
|
| 03 Jul 2015 05:37 PM |
@Anime
pcall() and spawn() are 2 COMPLETELY different things.
pcall() puts the block-of-code in 'protected' mode which basically means if the code errors than it wouldn't impact the rest of the code.
spawn() makes the block-of-code run in another thread, which allows other things to be ran at the same time.
I used spawn() because I wanted all the players to spawn at the same time.
pcall() would be useless as :LoadCharacter never errors. |
|
|
| Report Abuse |
|
|
AnimeWiki
|
  |
| Joined: 26 Oct 2014 |
| Total Posts: 460 |
|
|
| 03 Jul 2015 05:42 PM |
| What ? then there is no point of spawn if they should be spawn at same time. |
|
|
| Report Abuse |
|
|
|
| 04 Jul 2015 02:51 AM |
I used spawn() to make sure I called :LoadCharacter on everyone AT THE SAME TIME.
If I didn't use spawn(), then there would be a small pause inbetween :LoadCharacter'ing the players. |
|
|
| Report Abuse |
|
|