LoadString (Method)

From Legacy Roblox Wiki
Revision as of 03:23, 27 April 2023 by Realjame (talk | contribs) (Text replacement - "</code>" to "</SyntaxHighlight>")
Jump to navigationJump to search
LoadString( string key )
Returns string
Description: Returns a string value that was previously saved to the player via SaveString with the same key. Returns an empty string ("") if key doesn't exist, not nil.
Member of: Player


Example

This code will load the string saved under the key "hi".

game.Players.PlayerAdded:connect(function(player) --Connection line. Fires when a player leaves the game.
	player:WaitForDataReady() --Waiting for the player's data to be ready.
		print(player:LoadString("hi")) --Prints to the output whatever value is saved to the key "hi" in that player.
	end
end)

See Also