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:

Previous Thread :: Next Thread 
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
04 Mar 2013 10:43 PM
Ok. I do understand that a LocalScript can't do that.

However, This debug message I got from a Server-sided script in Workspace.

"LocalScript cannot use SaveNumber."

The script source is here.

_G.SaveSkills = function (player)
if player and player:IsA("Player") then
local a1,b1 = coroutine.resume(coroutine.create(function ()
local p = _G.PlayersData[player.Name]
if p and p.playerClass.Race~="" and p.SaveSlot and p.SaveSlot ~= "" then
for i=1, #p.playerSkillTree do
for id=1, #p.playerSkillTree[i] do
local header = p.SaveSlot.."SkillSlot_"..i.."_"..id.."_"
player:SaveNumber(header.."Point", p.playerSkillTree[i][id][1])
player:SaveNumber(header.."SES", p.playerSkillTree[i][id][2])
end
end
end
end))
if not a1 then _G.Chat("System","Error:_G.SaveSkills("..player.Name.."):"..b1) end

end
end

It is a server-sided script on workspace.. and the message appear on only some of the players. -.-
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
04 Mar 2013 10:44 PM
Any suggestion to prevent that bug?..
Report Abuse
StormRecon is not online. StormRecon
Joined: 15 Aug 2010
Total Posts: 2214
04 Mar 2013 11:09 PM
It might be because you used a global function.
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
04 Mar 2013 11:27 PM
Ok, thx, Let me try.
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
05 Mar 2013 12:02 AM
Where are you getting this error message from?
My guess is you're getting it in Start Server > Start Player or Play Solo, which works slightly differently than actual game servers.
Report Abuse
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
05 Mar 2013 12:14 AM
Player Data can't be called from a local script.
Report Abuse
RoboTestGear is not online. RoboTestGear
Joined: 28 Dec 2009
Total Posts: 3063
05 Mar 2013 12:16 AM
Didn't care to read some of your post sorry, just skipped.

I don't believe it's the Global side.
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
05 Mar 2013 10:13 AM
I get this error in game.

so the _G.Chat("System",messagehere) is a function that show message to my gui.
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
05 Mar 2013 10:14 AM
in actual game server*
Report Abuse
12packkid is not online. 12packkid
Joined: 24 Jun 2011
Total Posts: 1418
05 Mar 2013 10:19 AM
Try this:


_G.SaveSkills = function (player)
if player ~= nil then
if player:IsA("Player") then
local a1,b1 = coroutine.resume(coroutine.create(function ()
local p = _G.PlayersData[player.Name]
if p and p.playerClass.Race~="" and p.SaveSlot and p.SaveSlot ~= "" then
for i=1, #p.playerSkillTree do
for id=1, #p.playerSkillTree[i] do
local header = p.SaveSlot.."SkillSlot_"..i.."_"..id.."_"
player:SaveNumber(header.."Point", p.playerSkillTree[i][id][1])
player:SaveNumber(header.."SES", p.playerSkillTree[i][id][2])
end end end end))
if not a1 then _G.Chat("System","Error:_G.SaveSkills("..player.Name.."):"..b1)
end end end end


--I added some extra stuff and made it cleaner.
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
05 Mar 2013 10:24 AM
Thanks for making it cleaner and longer.
so Any suggestion about that message?
Report Abuse
Waffle3z is not online. Waffle3z
Joined: 15 Apr 2011
Total Posts: 266
05 Mar 2013 10:38 AM
I've noticed that you can't use Data Persistence in a separate thread; it all has to be in the same thread.
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
05 Mar 2013 08:34 PM
Thanks. I will use pcall instead.
Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
05 Mar 2013 09:42 PM
Lol.

I had this same problem.

player:WaitForDataReady()
Report Abuse
d4rk886 is not online. d4rk886
Joined: 17 Nov 2009
Total Posts: 1150
07 Mar 2013 04:54 AM
I have another function like that..

_G.SaveAll = function (player)
if _G.PlayersData[player.Name].SaveSlot == "" or (not player:FindFirstChild("DataReady")) then
return "Character Data haven't loaded yet."
end
player:WaitForDataReady()
_G.SaveClass(player)
_G.SaveSkills(player)
_G.SaveEquipment(player)
_G.SaveInventory(player)
_G.SaveQuest(player)
_G.SaveBindStone(player)
_G.SaveStat(player)
end

Report Abuse
Xnite515 is not online. Xnite515
Joined: 18 Feb 2011
Total Posts: 22763
08 Mar 2013 12:09 AM
Wrap it in pcall?
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