LoadInstance (Method): Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
m Text replacement - "<code lua>" to "<SyntaxHighlight code="lua">"
Tags: mobile web edit mobile edit
m Text replacement - "</code>" to "</SyntaxHighlight>"
Line 18: Line 18:
print(player:LoadInstance("Model"))
print(player:LoadInstance("Model"))
end)
end)
</code>
</SyntaxHighlight>


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

Revision as of 04:07, 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)

See Also