Hello, I've made a DataStore in which it'll save the value "Power" I have enabled API Services, HttpService, Create and Save Place API, and yet it still comes out with this error:

API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))

Here is the code:

local DataStore =  game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("PowerSaveSystem")

game.Players.PlayerAdded:connect(function(player)
	local leader = Instance.new("Folder", player)
	leader.Name = "leaderstats"
	local Power = Instance.new("IntValue", leader)
	Power.Name = "Power"
	Power.Value = ds:GetAsync(player.UserId) or 0
	ds:SetAsync(player.UserId, Power.Value)
	Power.Changed:connect(function()
		ds:SetAsync (player.UserId, Power.Value)
	end)
end)

game.Players.PlayerRemoving:connect(function(player)
	ds:SetAsync(player.UserId, player.leaderstats.Power.Value)
end)

4 comments

0

I am sure that this error will only occur in studio

1

No it would not, because how would the datastore plugins work?

0

The second parameter in instance.new is depricated the alternative is create instance then do the parent of that instance plus connect is depricated use Connect

0

Still doesnt work @saSlol2436