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

Why can i save with Datastores?

Asked by 5 years ago
Edited 5 years ago

When ever I try to save using datastores I get this error:

502: API Services rejected request with error. HTTP 403 (Forbidden) Stack Begin Script 'ServerScriptService.PlayerStast', Line 20 Stack End

this is my code:


local DSS = game:GetService("DataStoreService") --Data stores local ds = DSS:GetDataStore("Cash") ---Cash game.Players.PlayerAdded:Connect(function(player) --PlayerStats local stats = Instance.new("Folder") stats.Name = "PlayerStats" stats.Parent = player --Cash local cash = Instance.new("IntValue") cash.Name = "Cash" cash.Parent = stats cash.Value = ds:GetAsync(player.UserId.."-cash") or 100 cash.Changed:Connect(function() ds:SetAsync(player.UserId.."-cash",player.PlayerStats.Cash.Value) end) end) game.Players.PlayerRemoving:Connect(function(player) ds:SetAsync(player.UserId.."-cash",player.PlayerStats.Cash.Value) end)
0
I awnsered your question RBLXNogin 187 — 5y
0
no you havent it is still not working.  Also it works fine on my brothers account deadwalker601 110 — 5y
0
i have created a new game and it works deadwalker601 110 — 5y

2 answers

Log in to vote
0
Answered by
RBLXNogin 187
5 years ago
Edited 5 years ago

Hello there, simple solution:

1. Go to the Develop page

2.Click on the Games tab and find your game

3.Click on the gear drop down and click "Configure"

4.Check the box labeled "Enable Studio Access to API Services:"

The reason for this is because ROBLOX Studio needs Acess to the API services inorder to read and send data from the client, thus requiring you to permit them to do so. Other than that the code will not work, especially in studio. Follow the steps in order to solve your problem.

0
Unlike the other awnser I explained what to do and gave you a reasoning. Please tell me if you have any more questions regarding DataStores and API services RBLXNogin 187 — 5y
0
Ive logged on to the owners account (my brother (we are creating a game together)) and it worked fine. But when i logged back on to my account it didnt work again deadwalker601 110 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

you should enable api services in order to do that you must go to game settings in the home tab in roblox studio then go to options and enable api services please accept this answer :)))

0
I have and it still has not worked deadwalker601 110 — 5y

Answer this question