|
| 25 Jun 2014 02:43 PM |
Here's my problem:
I have a one person server.
I have a lot of HTTPRequests, but not going over the limit.
When the player leaves, I need to use UpdateAsync twice to update two tables.
I've tried doing this, but the server seems to shut down before the requests are sent. Remember, there's only one person in the server. How do I fix this? |
|
|
| Report Abuse |
|
|
Bebee2
|
  |
| Joined: 17 May 2009 |
| Total Posts: 3985 |
|
|
| 25 Jun 2014 02:45 PM |
Yield the shutdown.
http://wiki.roblox.com/index.php?title=OnClose_(Callback)
You will need that. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2014 03:06 PM |
I tried:
game.OnClose = function() if script.CurrentApplicationBeingViewed.Value ~= "" then
local tab = script.CurrentApplicationBeingViewed.Value tab = game:GetService("HttpService"):JSONDecode(tab) local id = tab[1] local done = false
DataStore:UpdateAsync("InReview", function(oldValue) if not oldValue then oldValue = {} end for i,v in pairs(oldValue) do if v == id then table.remove(oldValue,i) break end end done = true return oldValue end)
DataStore:UpdateAsync("Applications", function(oldValue) if not oldValue then oldValue = {} end table.insert(oldValue, tab) return oldValue end)
repeat wait(1) until done
end end
It didn't work. |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2014 03:15 PM |
Is it the fact that I used:
game.OnClose = function()
end
And not:
game.Close:connect(function()
end)
Or:
game.OnClose:connect(function()
end) |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2014 03:17 PM |
Its
game.OnClose = function()
end |
|
|
| Report Abuse |
|
|
|
| 25 Jun 2014 03:22 PM |
| Then what's wrong? Does UpdateAsync work for you guys when you use OnClose? |
|
|
| Report Abuse |
|
|
| |
|
|
| 25 Jun 2014 05:21 PM |
| Bump 2. I really need this guys. |
|
|
| Report Abuse |
|
|
| |
|