SaveString (Method): Difference between revisions
From Legacy Roblox Wiki
Jump to navigationJump to search
>Itunes89 No edit summary |
m Text replacement - "<SyntaxHighlight code="lua">" to "<syntaxhighlight lang="lua">" |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 9: | Line 9: | ||
==Example== | ==Example== | ||
This code will save "Hi Player" when | This code will save "Hi Player" when the player leaves the game. | ||
< | <syntaxhighlight lang="lua"> | ||
game.Players.PlayerRemoving:connect(function(player) --Connection line. Fires when a player leaves the game. | game.Players.PlayerRemoving:connect(function(player) --Connection line. Fires when a player leaves the game. | ||
player:WaitForDataReady() --Waiting for the players data to be ready. | player:WaitForDataReady() --Waiting for the players data to be ready. | ||
Line 16: | Line 16: | ||
end | end | ||
end) | end) | ||
</ | </syntaxhighlight> | ||
==See Also== | ==See Also== |
Latest revision as of 06:03, 27 April 2023
SaveString( string key, string value ) | |
Returns | nil |
Description: | Saves a string that can be reloaded from any server via LoadString. The DataCost used by a saved string can be removed by saving an empty string ("") as the value. |
Member of: | Player |
Example
This code will save "Hi Player" when the player leaves the game.
game.Players.PlayerRemoving:connect(function(player) --Connection line. Fires when a player leaves the game.
player:WaitForDataReady() --Waiting for the players data to be ready.
player:SaveString("hi", "Hi Player")--When you load a string using this key, it will say "Hi Player"
end
end)