On line 17 I get print error I dont know why this is happening? I get error 502: API Services rejected request with error. HTTP 403 (Forbidden)
local DS = game:GetService("DataStoreService") local DS1 = DS:GetDataStore("SaveJoins") game.Players.PlayerAdded:Connect(function(player) local leaderstats = player:WaitForChild("leaderstats") local joins = Instance.new("IntValue") joins.Name = "Joins" joins.Parent = leaderstats local PlayerUserId = "Player_"..player.UserId local data local success, errormessage = pcall(function() data = DS1:GetAsync(PlayerUserId) end) if success then joins.Value = data + 1 else print("error") warn(errormessage) end end) game.Players.PlayerRemoving:Connect(function(player) local PlayerUserId = "Player_"..player.UserId local data = player.leaderstats.Joins.Value local success, errormessage = pcall(function() DS1:SetAsync(PlayerUserId, data) end) if success then print("success") else print("error") warn(errormessage) end end)
Go to Game Settings in studio and press Options. Then, turn "Enable API Services" on.