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: game.OnClose = function()

Previous Thread :: Next Thread 
DevGamerzz is not online. DevGamerzz
Joined: 21 Dec 2015
Total Posts: 154
21 Feb 2016 10:51 AM
How do you put Player Removing and this together?


#code if Developer == true then print('Developer') end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Feb 2016 10:52 AM
game.OnClose = function() wait(5) end

That's all you need to do. They operate individually, you don't need to merge them.


Report Abuse
DevGamerzz is not online. DevGamerzz
Joined: 21 Dec 2015
Total Posts: 154
21 Feb 2016 10:53 AM
Where does the SetAsync go in that?

#code if Developer == true then print('Developer') end
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
21 Feb 2016 10:54 AM
It doesn't. This only holds the game open for five seconds to give time for you to save data in PlayerRemoving or something.


Report Abuse
Link5659 is not online. Link5659
Joined: 04 Jun 2012
Total Posts: 4525
21 Feb 2016 10:55 AM
do on close to save
Report Abuse
DevGamerzz is not online. DevGamerzz
Joined: 21 Dec 2015
Total Posts: 154
21 Feb 2016 10:57 AM
So they go seperate, not combined?
I'll give you my save, and can you write it correctly?

#code if Developer == true then print('Developer') end
Report Abuse
128Gigabytes is online. 128Gigabytes
Joined: 17 Apr 2014
Total Posts: 3616
21 Feb 2016 10:59 AM
Can you set game.OnClose in studio and have it save online?
Report Abuse
DevGamerzz is not online. DevGamerzz
Joined: 21 Dec 2015
Total Posts: 154
21 Feb 2016 11:10 AM
--THIS IS HOW I HAVE IT WRITTEN
game.Players.PlayerRemoving:connect(function(player)
if player:FindFirstChild("statnumbers") ~= nil then
local Key = "user_"..player.userId
local ValuesToSave = {player.statnumbers.xp.Value,player.statnumbers.Level.Value,player.statnumbers.Kills.Value,player.statnumbers.Deaths.Value,player.statnumbers.GhostKills.Value,player.statnumbers.DemonKills,player.statnumbers.Cilicoins.Value}
DataStore:SetAsync(Key,ValuesToSave)
end
end)
game.OnClose = function()
wait(10)
end

#code if Developer == true then print('Developer') end
Report Abuse
DevGamerzz is not online. DevGamerzz
Joined: 21 Dec 2015
Total Posts: 154
21 Feb 2016 11:19 AM
cmon, b1

#code if Developer == true then print('Developer') end
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