LoadNumber (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens
No edit summary
m Text replacement - "</SyntaxHighlight>" to "</syntaxhighlight>"
 
(4 intermediate revisions by 2 users not shown)
Line 13: Line 13:
This code would print the number saved to the "Number" key of every player that enters.
This code would print the number saved to the "Number" key of every player that enters.


<code lua>
<syntaxhighlight lang="lua">
game.Players.PlayerAdded:connect(function(player)
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
player:WaitForDataReady()
print(player:LoadNumber("Number"))
print(player:LoadNumber("Number"))
end)
end)
</code>
</syntaxhighlight>


==See Also==
==See Also==

Latest revision as of 06:20, 27 April 2023

LoadNumber( string key )
Returns number
Description: Returns a number value that was previously saved to the player via SaveNumber with the same key. If the key doesn't exist, it returns 0, not nil.
Member of: Player


Example

This code would print the number saved to the "Number" key of every player that enters.

game.Players.PlayerAdded:connect(function(player)
	player:WaitForDataReady()
	print(player:LoadNumber("Number"))
end)

See Also