How can I auto save a **IntValue ** and a **StringValue ** in workspace? Is it possible?
COMMUNITY QUESTION
How can I save a IntValue and a StringValue in workspace?
2 answers
Could you explain in a little more detail? An example would be nice too
Something like this except in workspace .
function onPlayerEntered(player)
wait(4)-- Change to wait for player longer.
player:WaitForDataReady()
repeat wait() until player:FindFirstChild("leaderstats")
if player.DataReady then
if player:findFirstChild("leaderstats") then
local score = player.leaderstats:GetChildren()
for i = 1,#score do
local ScoreLoaded = player:LoadNumber(score[i].Name)
wait()
if ScoreLoaded ~= 0 then
score[i].Value = ScoreLoaded
end
end
end
end
end
function onPlayerLeaving(player)
if player:findFirstChild("leaderstats") then
local score = player.leaderstats:GetChildren()
for i = 1,#score do
player:SaveNumber(score[i].Name,score[i].Value)
end
end
end
game.Players.PlayerAdded:connect(onPlayerEntered)
game.Players.PlayerRemoving:connect(onPlayerLeaving)
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Just did
Right, it is possible through Data Stores or Data Presistance. Check the wiki for more info