I have tried numerous ways to get it to work, unsure if it is a bug or not but can someone help me please The error I keep receiving is 19:29:22.015 - 502: API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))
Here is the script if you want to have a look at it.
local data = game:GetService("DataStoreService") local datastore = data:GetDataStore("RebornDataInitialiser") game.Players.PlayerAdded:Connect(function(player) local userid = tostring(player.userId) local data1 = Instance.new("Folder") data1.Name = "Data" data1.Parent = player local xp = Instance.new("IntValue") xp.Name = "XP" xp.Value = 0 xp.Parent = data1 local level = Instance.new("IntValue") level.Name = "Level" level.Value = 0 level.Parent = data1 local saving = datastore:GetAsync(userid) if saving then level.Value = saving[1] xp.Value = saving[2] else local plr_data = {level.Value, xp.Value} datastore:SetAsync(userid, plr_data) game.Players.PlayerRemoving:Connect(function(player) local id = tostring(player.userId) local plr_data2 = {player.Data.Level.Value, player.Data.XP.Value} datastore:SetAsync(id, plr_data2) end) end end)
I’m not so sure but when I’ve tested this out before I’d get that error message and I would just put some waits in, which would mostly resolve my issue
local data = game:GetService("DataStoreService") local datastore = data:GetDataStore("RebornDataInitialiser") game.Players.PlayerAdded:Connect(function(player) local userid = tostring(player.userId) wait(2) local data1 = Instance.new("Folder") data1.Name = "Data" data1.Parent = player wait(2) local xp = Instance.new("IntValue") xp.Name = "XP" xp.Value = 0 xp.Parent = data1 wait(2) local level = Instance.new("IntValue") level.Name = "Level" level.Value = 0 wait(2) level.Parent = data1 local saving = datastore:GetAsync(userid) if saving then level.Value = saving[1] xp.Value = saving[2] else local plr_data = {level.Value, xp.Value} datastore:SetAsync(userid, plr_data) game.Players.PlayerRemoving:Connect(function(player) local id = tostring(player.userId) local plr_data2 = {player.Data.Level.Value, player.Data.XP.Value} datastore:SetAsync(id, plr_data2) end) end end)