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

Help with Datastores?

Asked by 8 years ago
local zauna = game:GetService("DataStoreService"):GetDataStore("Zauna")

script.Parent.MouseButton1Click:connect(function(player)
    local leaderstats = player.leaderstats
    local zaunapoints = player.leaderstats.Zauna

    local key = "user_" .. player.userId
    wait(0.1)
    zauna:UpdateAsync(key, zaunapoints.Value)
end)

I'm really new to Datastores, and I'm really confused with them. I can't really see what I'm doing wrong. I don't know, but maybe the "player" variable doesn't really access the player? Or maybe a capitalization error? I can't really find anything. I really don't know much about datastores. I'm just experimenting because I'm trying to get a working saving script in my game.

0
What are you trying to do here? lucas4114 607 — 8y
0
nevermind, i got it working. it was probably glitched or something. mikey160 0 — 8y
0
Also, I was trying to make a save button. mikey160 0 — 8y
0
Oh, ok then. lucas4114 607 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

Yeah it seems you figured it out. Just remember that MouseButton1Down doesn't give the player. You would use a local script to get the player for GUIs. The use remote events to communicate with the server and save. Good luck!

Ad

Answer this question