Thanks for the big help on my last problem. Unfortunately, I ran my code and it just.... didn't work in the slightest... I have activated the studio api. Can someone please see what's wrong?
local DataStoreService = game:GetService("DataStoreService")
local currencyStore = DataStoreService:GetDataStore("PlayerCurrency")
local player = script.Parent.PlayerName.Value
local currency = script.Parent.Currency.Value
local value = script.Parent.Currency
local button = script.Parent.Parent.OnButton.ClickDetector
local first = script.Parent.First.Value
value.Changed:Connect(function() -- Enclosing function
local saved, err = pcall(function()
currencyStore:SetAsync(player, currency, first)
end)
if not saved then warn(err) end
end)
button.MouseClick:Connect(function(player)
local loaded, err = pcall(function(player)
return currencyStore:GetAsync(player, currency, first)
end)
if loaded then
script.Parent.Currency.Value = currency
script.Parent.First.Value = first
print("data loaded")
script.Parent.PlayerName.Value = player
end
end)
It didn't output any error, but even after having written currencyStore:SetAsync("20002000sa", 2000, false) on the 3rd line, it didn't change anything.

3 comments
Where is the script?
???? well besides that why are saving first and getting first?
:SetAsync has two parameters: essentially the key and the value being set to that key. https://developer.roblox.com/en-us/api-reference/function/GlobalDataStore/SetAsync