SaveBoolean (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>MrNicNac
No longer AdminOnly.
>JulienDethurens
When you make an example, PLEASE EXPLAIN IT. Just giving them code is useless if you don't explain what it does.
Line 9: Line 9:
{{clear floats}}
{{clear floats}}


<pre>
{{Example|
game.Players.PlayerAdded:connect(function(newPlayer)
This example will save true as the value of the key 'HasPlayed' everytime a player leaves.
newPlayer:WaitForDataReady()
 
newPlayer:SaveBoolean("Bool", game.Workspace.Boolean)
<code lua>
game.Players.PlayerRemoving:connect(function(player)
if player.DataReady then -- To make sure the data is ready.
player:SaveBoolean('HasPlayed', true) -- Save the boolean.
end
end)
end)
</pre>
</code>}}


[[Category:Methods]]
[[Category:Methods]]

Revision as of 10:14, 21 January 2012

SaveBoolean( String key, Bool value )
Returns nil
Description: Saves a boolean value that can be reloaded from any server via LoadBoolean
Member of: Player


Example

This example will save true as the value of the key 'HasPlayed' everytime a player leaves.

game.Players.PlayerRemoving:connect(function(player) if player.DataReady then -- To make sure the data is ready. player:SaveBoolean('HasPlayed', true) -- Save the boolean. end end)