SaveNumber (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Legend26
Undo revision 53565 by Itunes89 (talk) - Using PlayerRemoving doesn't always work.
>Itunes89
Line 13: Line 13:


<code lua>
<code lua>
game.Players.PlayerAdded:connect(function(player)
game.Players.PlayerRemoving:connect(function(player)
player:WaitForDataReady()
player:WaitForDataReady()
player:SaveNumber("Number", 5)
player:SaveNumber("Number", 5)

Revision as of 17:01, 17 March 2012

SaveNumber( string key, float value )
Returns nil
Description: Saves a number value that can be reloaded from any server via LoadNumber. The DataCost taken up by a saved number can be removed by saving 0 as the value.
Member of: Player


Example

This code would save the number 5 to the key "Number" when a player leaves:

game.Players.PlayerRemoving:connect(function(player) player:WaitForDataReady() player:SaveNumber("Number", 5) end)

See Also