LoadInstance (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>JulienDethurens No edit summary |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 13: | Line 13: | ||
This code would print the name of the {{type|Instance|RBX.lua.Instance (Object)}} saved in the "Model" key of every player that enters, or nil if that key doesn't exist yet. | This code would print the name of the {{type|Instance|RBX.lua.Instance (Object)}} saved in the "Model" key of every player that enters, or nil if that key doesn't exist yet. | ||
< | <syntaxhighlight lang="lua"> | ||
game.Players.PlayerAdded:connect(function(player) | game.Players.PlayerAdded:connect(function(player) | ||
player:WaitForDataReady() -- Wait for the player's data cache to load | player:WaitForDataReady() -- Wait for the player's data cache to load | ||
print(player:LoadInstance("Model")) | print(player:LoadInstance("Model")) | ||
end) | end) | ||
</ | </syntaxhighlight> | ||
==See Also== | |||
*[[File:Method Icon.png]] [[LoadBoolean (Method)|LoadBoolean]] | |||
*[[File:Method Icon.png]] [[LoadNumber (Method)|LoadNumber]] | |||
*[[File:Method Icon.png]] [[LoadString (Method)|LoadString]] | |||
[[Category:Methods]] | [[Category:Methods]] |
Latest revision as of 06:08, 27 April 2023
LoadInstance( string key ) | |
Returns | RBX.lua.Instance (Object) |
Description: | Loads an instance value that was previously saved to the player via SaveInstance. |
Member of: | Player |
Example
This code would print the name of the RBX.lua.Instance (Object) saved in the "Model" key of every player that enters, or nil if that key doesn't exist yet.
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady() -- Wait for the player's data cache to load
print(player:LoadInstance("Model"))
end)