Key requests keep filling(DataStore)

Hello im doing data stores, everything is saving except that everytime it saves it does this until the limit is reached (i think its within the autosaves code, every 30 seconds)

https://gyazo.com/647823dc25c5b21d5c566769112cfd1a

Ive put a print command in their before and its done the same thing. It first prints once, then twice, then 3 times and so on until the request is full.

local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("PlayerData")


game.Players.PlayerAdded:Connect(function(Plr)
	local stats = Instance.new("Folder", Plr)
	stats.Name = "Stats"
	--- Level System
	local Level = Instance.new("NumberValue", stats)
	Level.Name = "Level"
	Level.Value = 1
	
	local Exp = Instance.new("NumberValue", stats)
	Exp.Name = "Exp"
	Exp.Value = 0
	
	local ExpNeed = Instance.new("IntValue", stats)
	ExpNeed.Name = "ExpNeed"
	ExpNeed.Value = 100
	
	--- Money and Spin System
	local Yen = Instance.new("IntValue", stats)
	Yen.Name = "Yen"
	Yen.Value = 0
	
	local Spins = Instance.new("NumberValue", stats)
	Spins.Name = "Spins"
	Spins.Value = 5	
	
	--- Stats System
	local Points = Instance.new("NumberValue", stats)
	Points.Name = "Points"
	Points.Value = 3
	
	local MaxHealth = Instance.new("IntValue", stats)
	MaxHealth.Name = "MaxHealth"
	MaxHealth.Value = 100
	
	local Stamina = Instance.new("IntValue", stats)
	Stamina.Name = "Stamina"
	Stamina.Value = 0
	
	local Quirk = Instance.new("StringValue", game.StarterGui.Values)
	Quirk.Name = "Abillity"
	Quirk.Value = "Quirkless"
	
	--- Fame
	local leaderstats = Instance.new("Folder",Plr)
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = Plr
	
	local Fame = Instance.new("IntValue")
	Fame.Name = "Fame"
	Fame.Value = 0
	Fame.Parent = leaderstats
	
	spawn(function()		
		
		wait(4)		
		
		local StaminaBarMax = Instance.new("IntValue",stats)		
		StaminaBarMax.Name = "AbilityStaminaMax"	
		StaminaBarMax.Value =  100 + (Plr.Stats.Stamina.Value*5)			
		
		local StaminaBar = Instance.new("IntValue",stats)	
		StaminaBar.Name = "AbilityStamina"	
		StaminaBar.Value = StaminaBarMax.Value		
	end)
	
	local Strength = Instance.new("IntValue", stats)
	Strength.Name = "Strength"
	Strength.Value = 0
	
	
	local playerdata = {
		Fame = Fame.Value,
		Quirk = Quirk.Value,
		Stamina = Stamina.Value,
		MaxHealth = MaxHealth.Value,
		Points = Points.Value,
		Spins = Spins.Value,
		Yen = Yen.Value,
		ExpNeed = ExpNeed.Value,
		Exp = Exp.Value,
		Level = Level.Value,	
		Strength = Strength.Value
	}
	
	local data
	local success, errormessage = pcall(function()
		 Data = DataStore:GetAsync(Plr.UserId)
	end)
	
if success then	
	if Data then
		playerdata.Fame = Data.Fame
		playerdata.Quirk = Data.Quirk
		playerdata.Stamina = Data.Stamina
		playerdata.MaxHealth = Data.MaxHealth
		playerdata.Points = Data.Points
		playerdata.Spins = Data.Spins
		playerdata.Yen = Data.Yen
		playerdata.ExpNeed = Data.ExpNeed
		playerdata.Exp = Data.Exp
		playerdata.Level = Data.Level
		playerdata.Strength = Data.Strength
	end	
end
	
	
	Fame.Value = playerdata.Fame
	Quirk.Value = playerdata.Quirk
	Stamina.Value = playerdata.Stamina
	MaxHealth.Value = playerdata.MaxHealth
	Points.Value = playerdata.Points
	Spins.Value = playerdata.Spins
	Yen.Value = playerdata.Yen
	ExpNeed.Value = playerdata.ExpNeed
	Exp.Value = playerdata.Exp
	Level.Value = playerdata.Level
	Strength.Value = playerdata.Strength
	
	while wait(30) do
		game.ReplicatedStorage.QuirkSpinner.QuirkSetter:FireClient(Plr)
		game.ReplicatedStorage.QuirkSpinner.QuirkSetter.OnServerEvent:Connect(function(player,Ability)
		playerdata.Fame = Fame.Value
		playerdata.Quirk = Ability
		playerdata.Stamina = Stamina.Value
		playerdata.MaxHealth = MaxHealth.Value
		playerdata.Points = Points.Value
		playerdata.Spins = Spins.Value
		playerdata.Yen = Yen.Value
		playerdata.ExpNeed = ExpNeed.Value
		playerdata.Exp = Exp.Value
		playerdata.Level = Level.Value
		playerdata.Strength = Strength.Value
		DataStore:SetAsync(Plr.UserId, playerdata)
			return
		end)	
	end
end)

game.Players.PlayerRemoving:Connect(function(player)
	game.ReplicatedStorage.QuirkSpinner.QuirkSetter:FireClient(player)
	game.ReplicatedStorage.QuirkSpinner.QuirkSetter.OnServerEvent:Connect(function(player,Ability)
	local playerdata = {}
	local Fame = player.leaderstats.Fame
	local stats = player.Stats
	local quirk = Ability
	local Stamina = stats.Stamina
	local MaxHealth = stats.MaxHealth
	local Points = stats.Points
	local Spins = stats.Spins
	local Yen = stats.Yen
	local ExpNeed = stats.ExpNeed
	local Exp = stats.Exp
	local Level = stats.Level
	local Strength = stats.Strength
	
	playerdata.Fame = Fame.Value
	playerdata.Quirk = quirk.Value
	playerdata.Stamina = Stamina.Value
	playerdata.MaxHealth = MaxHealth.Value
	playerdata.Points = Points.Value
	playerdata.Spins = Spins.Value
	playerdata.Yen = Yen.Value
	playerdata.ExpNeed = ExpNeed.Value
	playerdata.Exp = Exp.Value
	playerdata.Level = Level.Value
	playerdata.Strength = Strength.Value
	
	local success, errormessage = pcall(function()
		DataStore:SetAsync(player.UserId, playerdata)
	end)
	
	if success then
		print("DataSaved")
	else
		print("Data Failed To Save")
		warn(errormessage)
	end
		
		
	end)		
end)

game.Players.PlayerAdded:Connect(function(player)	
	wait(5)
	local Exp = player.Stats.Exp
	local Level = player.Stats.Level
	local Points = player.Stats.Points
	local ExpNeed = player.Stats.ExpNeed	
	Exp.Changed:Connect(function()
		while Exp.Value >= ExpNeed.Value and Level.Value <= 1999 do
			wait(0.4)		
			print("Levels")
			if Exp.Value >= ExpNeed.Value and Level.Value <= 1999 then --and Level.Value <= 1999
				Level.Value = Level.Value + 1
				Points.Value = Points.Value + 3
				Exp.Value = Exp.Value - ExpNeed.Value
				ExpNeed.Value = ExpNeed.Value + 100
				local levelup = script:WaitForChild("Level Up"):Clone()
				local particle = script:WaitForChild("particle"):Clone()
				particle.Name = player.Name .."'s LevelUp Particle"
				
				spawn(function()
				particle.Parent = workspace
				particle.CFrame = player.Character.HumanoidRootPart.CFrame
				wait(0.4)	
				particle.particle.LevelUp.Rate = 0			
			end)	
				levelup.Parent = player.Character.HumanoidRootPart
				levelup:Play()
				local detroy = game:GetService("Debris")
				detroy:AddItem(levelup,1)
				detroy:AddItem(particle,3)
				wait(.4)
			end
			wait(.4)
		end
	end)	
end)

Just skimming through your code, is there a possibility that your saving your values too quick? I don’t think it’s necessary to save every 30 secs, maybe ever few minutes or so? Additionally, you’re saving a lot at once. Data requests usually fill up because there’s too many calls.

Alright ill try once every minute and tell u how it goes thanks

it still does it i think my problem is that it is firing twice

It’s firing quite a bit possibly because of this loop. Otherwise, I’m not sure. Maybe try add prints to see what key is queuing. Also do you know if this happens when the player joins the game or when they leave?

this happends when im alone in the game studio, idk about join/leaving the game. in the studio it happends when it autosaves

when i removed my connected function it seems to work fine i asume its that

removing

game.ReplicatedStorage.QuirkSpinner.QuirkSetter:FireClient(player)
	game.ReplicatedStorage.QuirkSpinner.QuirkSetter.OnServerEvent:Connect(function(player,Ability)

Im going to try to add a debounce to it and see

Hmm, your firing an Event to the client, then trying to receive it on the server?

yea i am and i think thats why it stacks idk for sure

fixed it, i just removed the events and put them in a different while loop