So, I am trying to create a script that will save, update and load the number of "Special" rocks value ( Number value).
I just can't understand how to save things...
The script is inside NumberValue.
This is what I've created so far and I know that it's a total fail. -_-
Please take some time to help me.
-- Saves and updates the value
local Datastore = game:GetService("DataStoreService"):GetDataStore("SpecialRockValue")
game.Players.PlayerAdded:Connect(function(player)
local Value = script.Parent
pcall(function()
local specialrocks = Datastore:GetAsync(player.UserId, Value)
end)
local Save = Datastore:SetASync(player.UserId, Value)
if Save then
Save.Value = Value.Value
end
end)
EDIT: I just want to say that I've also read every catalog about Datastore on ROBLOX Wiki but still no help.

8 comments
userId is deprecated. So is the Instance.new parent argument. You should also save the number itself not the table. It's pointless.
Thanks for the pointers, incapaz. But, I was saving the table incase he wanted to add more values into it.
I edited it a bit but still thanks for the answer
Um
Is it not working now?
Oh my bad I fixed the problem
Alright Ill try it tommorow cuz its night to me now
Alright