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

DataStore not requesting data properly? (nil)

Asked by
Ap_inity 112
5 years ago

I'm not sure what I'm doing but this code is wrong, it says at line 6, there's a nil value.

Here's my script:

script.Parent.GetInfo.MouseButton1Click:Connect(function()
    local user = script.Parent.Username.Input.Text
    local key = game.Players:GetUserIdFromNameAsync(user)
    local saves = DSS:GetAsync("player-"..key)
    if saves then
        frame.CAmount.Text = "Credits: "..saves.Credits -- This is nil?
        frame.CrAmount.Text = "Crystals: "..saves.Crystals
        frame.Exp.Text = "Exp: "..saves.Exp
        frame.Levels.Text = "Levels: "..saves.Levels
        frame.Username.Text = "Username: "..user
    end
end)

This is run on a script in StarterGui, used for an admin panel.

0
Yes, there's a separate script for the DataStore values. Ap_inity 112 — 5y
1
Has it worked before? Because from what I heard, there was a problem with Roblox studio today with data storing. RAYAN1565 691 — 5y
0
No, I just wrote this today. Ap_inity 112 — 5y
0
And I haven't had any troubles with datastore so far, except that. Ap_inity 112 — 5y
0
DataStore is server side only. You can't use them on the client. User#19524 175 — 5y

Answer this question