LoadInstance (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>MrNicNac No longer AdminOnly. |
>JulienDethurens No edit summary |
||
Line 1: | Line 1: | ||
<onlyinclude>{{Method | <onlyinclude>{{Method | ||
|name = LoadInstance | |name = LoadInstance | ||
|arguments = | |arguments = {{type|string}} <var>key</var> | ||
|description = Loads an instance value that was previously saved to the player via [[SaveInstance (Method)|SaveInstance]]. | |description = Loads an instance value that was previously saved to the player via [[SaveInstance (Method)|SaveInstance]]. | ||
|object = Player | |object = Player | ||
|returns = | |returns = {{type|Instance|RBX.lua.Instance (Object)}} | ||
}}</onlyinclude> | }}</onlyinclude> | ||
{{clear floats}} | {{clear floats}} | ||
< | ==Example== | ||
game.Players.PlayerAdded:connect(function( | |||
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. | |||
<code lua> | |||
game.Players.PlayerAdded:connect(function(player) | |||
player:WaitForDataReady() -- Wait for the player's data cache to load | |||
print(player:LoadInstance("Model")) | |||
end) | end) | ||
</ | </code> | ||
[[Category:Methods]] | [[Category:Methods]] |
Revision as of 23:47, 12 February 2012
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)