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.

5 comments

0

Yes, there's a separate script for the DataStore values.

1

Has it worked before? Because from what I heard, there was a problem with Roblox studio today with data storing.

0

No, I just wrote this today.

0

And I haven't had any troubles with datastore so far, except that.

0

DataStore is server side only. You can't use them on the client.