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
 

Using UpdateAsync on PlayerRemoving

Previous Thread :: Next Thread 
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
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 is not online. 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
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
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
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
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
Notunknown99 is not online. Notunknown99
Joined: 05 Sep 2008
Total Posts: 25360
25 Jun 2014 03:17 PM
Its

game.OnClose = function()

end
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
25 Jun 2014 03:22 PM
Then what's wrong? Does UpdateAsync work for you guys when you use OnClose?
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
25 Jun 2014 03:37 PM
Bump 1.
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
25 Jun 2014 05:21 PM
Bump 2. I really need this guys.
Report Abuse
theroadrunner is not online. theroadrunner
Joined: 06 Oct 2010
Total Posts: 862
25 Jun 2014 06:01 PM
Bump 3.
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