LoadBoolean (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>MrNicNac
No longer AdminOnly.
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">"
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<onlyinclude>{{Method
<onlyinclude>{{Method
|name                = LoadBoolean
|name                = LoadBoolean
|arguments            = [[String]] key
|arguments            = {{type|string}} <var>key</var>
|description          = Returns a boolean value that was previously saved to the player via [[SaveBoolean (Method)|SaveBoolean]] with the same key. Returns false if the key doesn't exist, not nil.
|description          = Returns a {{type|boolean}} value that was previously saved to the player via [[SaveBoolean (Method)|SaveBoolean]] with the same key. Returns {{false}} if the key doesn't exist, not nil.
|object              = Player
|object              = Player
|returns              = [[Bool]] value
|returns              = {{type|bool}}
}}</onlyinclude>
}}</onlyinclude>


{{clear floats}}
{{clear floats}}


<pre>
==Example==
game.Players.PlayerAdded:connect(function(newPlayer)
 
newPlayer:WaitForDataReady()
This code would print the {{type|boolean}} value saved to the "Bool" key of every player that enters.
p = newPlayer:LoadBoolean("Bool")
 
game.Workspace.Brick.CanCollide = p.Value
<syntaxhighlight lang="lua">
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
print(player:LoadBoolean("Bool"))
end)
end)
</pre>
</syntaxhighlight>
 
==See Also==
*[[File:Method Icon.png]] [[LoadNumber (Method)|LoadNumber]]
*[[File:Method Icon.png]] [[LoadString (Method)|LoadString]]
*[[File:Method Icon.png]] [[LoadInstance (Method)|LoadInstance]]
 
[[Category:Methods]]
[[Category:Methods]]

Latest revision as of 06:08, 27 April 2023

LoadBoolean( string key )
Returns bool
Description: Returns a boolean value that was previously saved to the player via SaveBoolean with the same key. Returns false if the key doesn't exist, not nil.
Member of: Player


Example

This code would print the boolean value saved to the "Bool" key of every player that enters.

game.Players.PlayerAdded:connect(function(player)
	player:WaitForDataReady()
	print(player:LoadBoolean("Bool"))
end)

See Also