Good day all!

In my game that I am currently making, people will recieve 20EXP every 5 minutes they spend in the game, but I am having a bit of a wobble with this.

I have my leaderboard script, which works a-okay! But I will link it down here anyways (It has a saving system in it as well.):

local DataSore = game:GetService("DataStoreService")
local ds = DataSore:GetDataStore("CashSaveSystem")

game.Players.PlayerAdded:connect(function(player)
	local folder = Instance.new("Folder", player)
	folder.Name = "leaderstats"
	local EXP = Instance.new("IntValue", folder)
	EXP.Name = "EXP"
	EXP.Value = ds:GetAsync(player.UserId) or 0
	ds:SetAsync(player.UserId, EXP.Value)
	EXP.Changed:connect(function()
		ds:SetAsync(player.UserId, EXP.Value)
	end)
end)

That's the leaderboard script with a save system in it.

And after that, I've been trying to make the script that gives the player 20EXP every 5 min. I will C+P what I have so far down here >> v

while true do
	wait(300)
	--Something Idk
end

That's all I have for that bit. Can someone please help me with this?

Many thanks.

-Harrydamastr.

3 comments

0

Actually, I know how to add a number onto a value. It's something like: EXP.Value = EXP.Value +20 or something.

0

yea like that

0

Yes, but how would it identify the player and find it's leaderstats folder?!