Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Saving DATA Help?

Asked by
iLegitus 130
9 years ago

So im trying to make a character customization,You only chose your character ONCE,So character customization will only appear for the first time you play,Then it saves your customization to somewhere forever,Then your character loads everytime from your custom data,+How would i achieve this?

Im aware of DataKeys or whatever,But i dont know how..

2 answers

Log in to vote
0
Answered by 9 years ago

http://wiki.roblox.com/index.php?title=Data_store

local DataStore = game:GetService("DataStoreService"):GetDataStore("DataTest")

game.Players.PlayerAdded:connect(function(player) -- Player entered

    local key = "user_" .. player.userId -- Gets there userId for new or old storage

    DataStore:UpdateAsync(key, function(oldValue) -- Starts updating there stat's
        local newValue = oldValue or 0 -- Finds or make's there data
        newValue = newValue + 50 --Add's 50 to newValue or 0
        print(newValue) -- Just for you to see the script updated c:
        return newValue -- Saved
    end)
end)
Ad
Log in to vote
0
Answered by
Muoshuu 580 Moderation Voter
9 years ago

Answer this question