SaveNumber (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
m Text replacement - "</code>" to "</SyntaxHighlight>" |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" Tags: mobile web edit mobile edit |
||
(One intermediate revision by the same user not shown) | |||
Line 12: | Line 12: | ||
This code would save the {{type|number}} 5 to the key "Number" when a player leaves: | This code would save the {{type|number}} 5 to the key "Number" when a player leaves: | ||
< | <syntaxhighlight lang="lua"> | ||
game.Players.PlayerRemoving:connect(function(player) | game.Players.PlayerRemoving:connect(function(player) | ||
if player.DataReady then | if player.DataReady then | ||
Line 18: | Line 18: | ||
end | end | ||
end) | end) | ||
</ | </syntaxhighlight> | ||
==See Also== | ==See Also== |
Latest revision as of 05:27, 27 April 2023
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)
if player.DataReady then
player:SaveNumber("Number", 5)
end
end)