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
|
  |
| Joined: 17 Nov 2009 |
| Total Posts: 1150 |
|
|
| 04 Mar 2013 10:44 PM |
| Any suggestion to prevent that bug?.. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2013 11:09 PM |
| It might be because you used a global function. |
|
|
| Report Abuse |
|
|
d4rk886
|
  |
| Joined: 17 Nov 2009 |
| Total Posts: 1150 |
|
| |
|
|
| 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 |
|
|
|
| 05 Mar 2013 12:14 AM |
| Player Data can't be called from a local script. |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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
|
  |
| Joined: 17 Nov 2009 |
| Total Posts: 1150 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 17 Nov 2009 |
| Total Posts: 1150 |
|
|
| 05 Mar 2013 08:34 PM |
| Thanks. I will use pcall instead. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| Joined: 18 Feb 2011 |
| Total Posts: 22763 |
|
| |
|