I have absolutely no idea what is going on but I have this data store error. https://gyazo.com/ebc3b0764096532293dae846bbad3f75
What I did was make a datastore in a module and made a function that either loads or saves the players data.
The problem I have is whenever I call the module in a playeradded event, it errors for some reason. When I attempt to save data via the playerremoving event, It works but for playeradded when I try to see if it even prints it doesn’t. about the HTTP 403 error, I have tried researching it but I can’t find any good answers as people either say “You don’t have API Services/HTTP requests enabled” while I have both of them on. I am also the owner of my game. Here is a good grasp of my code pieces for the module side and playeradded event.
–Module (only includes when player is added)
function update.PlayerData(player, saveorload)
if saveorload == "load" then
local s, e = pcall(function()
return playerdatastore:GetAsync("Player_"..player.UserId)
end)
local data
if s then
print("successfully loaded")
data = playerdatastore:GetAsync("Player_"..player.UserId)
for i,v in pairs(data) do
player:WaitForChild("Stats")[i].Value = v
end
end
if e then
warn(e)
end
if data == nil then
local savedata = {
Speed = 0;
Damage = 5;
Protection = 0;
Level = 1;
EXP = 0;
}
for i,v in pairs(savedata) do
player:WaitForChild("Stats")[i].Value = v
end
playerdatastore:SetAsync("Player_"..player.UserId, savedata)
end
end
end ```
--Script
```local update = require(game.ServerScriptService.Scripts["Data/Modules"].Update)
game.Players.PlayerAdded:connect(function(player)
-- insert stat values here
update.PlayerData(player, "load")
end)