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: Load character breaking?

Previous Thread :: Next Thread 
NotSoNorm is online. 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 is online. 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 is online. NotSoNorm
Joined: 01 Sep 2009
Total Posts: 116
03 Jul 2015 11:19 AM
bump


~PM me for really rare pepes~
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
03 Jul 2015 11:31 AM
for _,plr in next, game.Players:GetPlayers() do
v:LoadCharacter()
end
Report Abuse
BlueWizard12345 is not online. BlueWizard12345
Joined: 31 Mar 2012
Total Posts: 906
03 Jul 2015 12:21 PM
Use a script.
Report Abuse
NotSoNorm is online. 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
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
03 Jul 2015 05:08 PM
oh sht change v to plr
Report Abuse
NotSoNorm is online. 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 is not online. 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 is online. 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 is not online. 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 is online. 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 is not online. 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 is online. 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 is not online. 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
darkelementallord is not online. darkelementallord
Joined: 23 Nov 2012
Total Posts: 54
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
darkelementallord is not online. darkelementallord
Joined: 23 Nov 2012
Total Posts: 54
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
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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 is online. 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 is online. 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 is not online. AnimeWiki
Joined: 26 Oct 2014
Total Posts: 460
03 Jul 2015 05:35 PM
@power


spawn really why not pcall ?
Report Abuse
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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 is not online. 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
powerhotmail123 is not online. powerhotmail123
Joined: 11 Apr 2011
Total Posts: 5041
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
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