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

Change specific value inside Datastore that has 6 values?

Asked by 4 years ago
Edited 4 years ago

So I am trying to make unban button basically you click the button and it sets the offline player datastore's banned value to false but i get this error. "ATTEMPT TO INDEX NIL VALUE" GetSaved[5].Value = false? ServerScript - GameScriptService

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore('GameData1')

game.ReplicatedStorage.Remotes.UnbanPlayer.OnServerInvoke = function(Player,PlayerName)
    local UserID = game.Players:GetUserIdFromNameAsync(PlayerName)
local GetSaved = DataStore:GetAsync(UserID)     
GetSaved[5].Value = false
    end
end

Button LocalScript

script.Parent.MouseButton1Click:Connect(function()
    local PlayerName = script.Parent.Parent.PlayerInput.Text
        game.ReplicatedStorage.Remotes.UnbanPlayer:InvokeServer(PlayerName)
end)

Answer this question