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

Can somebody explain DataStore a little better?

Asked by 10 years ago

I don't quite understand it

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

game.Players.PlayerAdded:connect(function(player)
    local key = "Weapon1" .. player.userId
    DataStore:GetAsync(key, function(oldValue)
        if oldValue == new then
            --code to give weaoon
        else
        print("weapon not owned")
    end)
end)

Would that work to check if somebody owned a weapon before?

0
You need to save the weapon to data store. NotsoPenguin 705 — 10y
0
I know that, but if I had it saved, would that work to check it? HomingBeacon 5 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago

I Love this script and how you made it, Yes. It does work, the problem is... You need to save the weapon to the data store

Ad

Answer this question