When I tried running my script that made stats for a character and made datastores for each stat, this error came up:
502: API Services rejected request with error: HTTP 0 (HTTP 403 (HTTP/1.1 403 Forbidden))
I removed the line, but it happened to each :GetAsync piece of the script
I wrote this entire script. I hope it was not for nothing.
local DataStoreService = game:GetService("DataStoreService")
local healthMaxData = DataStoreService:GetDataStore("healthMaxData")
local healthPresentData = DataStoreService:GetDataStore("healthPresentData")
local staminaMaxData = DataStoreService:GetDataStore("staminaMaxData")
local staminaPresentData = DataStoreService:GetDataStore("staminaPresentData")
local hungerMaxData = DataStoreService:GetDataStore("hungerMaxData")
local hungerPresentData = DataStoreService:GetDataStore("humgerPresentData")
game.Players.PlayerAdded:connect(function(plr)
local statsFolder = Instance.new("Folder", plr)
statsFolder.Name = "statsFolder"
local healthMax = Instance.new("IntValue", statsFolder)
healthMax.Name = "healthMax"
healthMax.Value = healthMaxData:GetAsync(tostring(plr.UserId)) or 100 -- right here is where the first error occured
local healthPresent = Instance.new("IntValue", statsFolder)
healthPresent.Name = "healthPresent"
healthPresent.Value = healthPresentData:GetAsync(tostring(plr.UserId)) or healthMax.Value
local staminaMax = Instance.new("IntValue", statsFolder)
staminaMax.Name = "staminaMax"
staminaMax.Value = staminaMaxData:GetAsync(tostring(plr.UserId)) or 100
local staminaPresent = Instance.new("IntValue", statsFolder)
staminaPresent.Name = "staminaPresent"
staminaPresent.Value = staminaPresentData:GetAsync(tostring(plr.UserId)) or staminaMax.Value
local hungerMax = Instance.new("IntValue", statsFolder)
hungerMax.Name = "hungerMax"
hungerMax.Value = hungerMaxData:GetAsync(tostring(plr.UserId)) or 100
local hungerPresent = Instance.new("IntValue", statsFolder)
hungerPresent.Name = "hungerPresent"
hungerPresent.Value = hungerPresentData:GetAsync(tostring(plr.UserId)) or hungerMax.Value
plr.CharacterAdded:connect(function(char)
if char:FindFirstChild("Humanoid") ~= nil then
local humanoid = char.Humanoid
humanoid.Health.Changed:connect(function()
healthPresent.Value = humanoid.Health
end)
humanoid.MaxHealth.Changed:connect(function()
healthMax.Value = humanoid.MaxHealth
end)
end
end)
healthMax.Changed:connect(function()
healthMaxData:SetAsync(tostring(plr.UserId), healthMax.Value)
end)
healthPresent.Changed:connect(function()
healthPresentData:SetAsync(tostring(plr.UserId), healthPresent.Value)
end)
staminaMax.Changed:connect(function()
staminaMaxData:SetAsync(tostring(plr.UserId), staminaMax.Value)
end)
staminaPresent.Changed:connect(function()
staminaPresentData:SetAsync(tostring(plr.UserId), staminaPresent.Value)
end)
hungerMax.Changed:connect(function()
hungerMaxData:SetAsync(tostring(plr.UserId), hungerMax.Value)
end)
hungerPresent.Changed:connect(function()
hungerPresentData:SetAsync(tostring(plr.UserId), hungerPresent.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(plr)
healthMaxData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFirstChild('healthMax').Value)
healthPresentData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFirstChild('healthPresent').Value)
staminaMaxData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFirstChild('staminaMax').Value)
staminaPresentData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFIrstChild('staminaPresent').Value)
hungerMaxData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFirstChild('hungerMax').Value)
hungerPresentData:SetAsync(tostring(plr.UserId), plr.statsFolder:FindFirstChild('hungerPresent').Value)
end)
Can anyone help me?

2 comments
I just started back in Lua and roblox coding so if it looks a bit messed up i'm a bit rusty.
Line 80 - "FindFIrstChild" is your typo. :)