How would I go about making an xp system

I was wondering how I would make an XP system for my game where whenever someone is in the game for 10 minutes they would get 1 XP? anything helps

Use a loop that gives players 1 XP every 10 minutes.

local Players = game:GetService("Players")

Players.PlayerAdded:Connect(function(player)
	local leaderstats = Instance.new("Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

	local XP = Instance.new("IntValue")
	XP.Name = "XP"
	XP.Parent = leaderstats
	
	task.spawn(function()
		while wait(600) do
			XP.Value += 1
		end
	end)
end)
1 Like