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

How do I make it so I can save a value or something with async?

Asked by 7 years ago

Well, I want an employee of the month thing in my cafe, and I want the image to be able to change and save with a gui with async, however I cant get it to work.

local DSService = game:GetService('DataStoreService'):GetDataStore('camgoucher123')
game.Players.PlayerAdded:connect(function(plr)

    -- GetAsync
    local GetSaved = DSService:GetAsync(game.Workspace.picture.SurfaceGui.ImageLabel.Image)
    if GetSaved then
        game.Workspace.picture.SurfaceGui.ImageLabel.Image = GetSaved[1]
    else
        local NumbersForSaving = {game.Workspace.picture.SurfaceGui.ImageLabel}
        DSService:SetAsync( NumbersForSaving)
    end
end)

game.Players.PlayerRemoving:connect(function(plr)

local Savetable = {game.Workspace.picture.SurfaceGui.ImageLabel.Image}
DSService:SetAsync(Savetable)   


end)

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago

I am assuming you mean DataStore, not Async.

You can use httpservice and make your own MySQL database or something, or you can spend some time reading the wiki.

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

Ad

Answer this question