I’m trying to make a system where a player inputs a code into a text box, and when they hit a button a local script sends that Code to the server using a remote function. Then the Server determines if its a valid code and if it hasn’t been redeemed and gives the player the amount of “Taps” assigned to the code if both values are met otherwise returning false. However, when I tested my scripts in game, no matter what code I entered, the script would always error saying “(Code I entered)” is not a valid member of GlobalDataStore “DataStoreService.codesStore”. Any idea whats wrong. Im assuming its something to do with the function below
local Codes = {
VizorPlays = {200},
NewPlayer1 = {100},
xX0124Xx = {70},
}
game.ReplicatedStorage.RedeemCode.OnServerInvoke = function(Player, Code)
local codesStore = DSS:GetDataStore("codesStore" .. Code)
local PlayerRedeemedCode = codesStore:GetAsync(Player.UserId)
if codesStore[Code] and not PlayerRedeemedCode then
Player.leaderstats.Taps.Value = Player.leaderstats.Taps.Value +codesStore[Code][1]
codesStore:SetAsync(Player.UserId, true)
return true
else
return false
end
end