I need help with s=a script that is supposed to save player data. I keep getting this Error
" Cannot write to DataStore from studio if API access is not enabled. Enable it by going to the Game Settings page."
I could not find API access in the settings.
This is the ServerScriptService Script
local PlayerStatManager = require(game.ServerStorage.ModuleScript)
This is ServerStorage Script
local PlayerStatManager = {} local DataStoreService = game:GetService('DataStoreService') local playerData = DataStoreService:GetDataStore('PlayerData') local AUTOSAVE_INTERVAL = 60 local sessionData = {} function PlayerStatManager:ChangeStat(player, statName, changeValue) sessionData[player][statName] = sessionData[player][statName] + changeValue end local function getPlayerData(player) return playerData:GetAsync(player.UserId) end local function savePlayerData(player) playerData:SetAsync(player.UserId, sessionData[player]) end local function setupPlayerData(player) local data = playerData:GetAsync(player.UserId) if not data then sessionData[player] = {Money = 0} savePlayerData(player) else sessionData[player] = data end end local function autosave() while wait(AUTOSAVE_INTERVAL) do for player, data in pairs(sessionData) do savePlayerData(player) end end end game.Players.PlayerAdded:connect(setupPlayerData) game.Players.PlayerRemoving:connect(function(player) savePlayerData(player) sessionData[player] = nil end) spawn(autosave) return PlayerStatManager