Npc that gives coins every few minutes

Hi,

How do I begin making a system where an npc gives you money every 5 minutes and it shows on a billboard gui the remaining time.

I have this at the moment.

local timershower = script.Parent.Parent.BillboardGui.TextLabel
local Prompt = script.Parent

Prompt.Triggered:Connect(function(Player)
	local Money = Player.leaderstats.Gold
	Money.Value += 10
end)

Set up an NPC, Create a addplayer function with a 5 min timer that gives them money.

1 Like

A rough idea of the concept…

local check = false
game.Players.PlayerAdded:Connect(function(player)
	check = true
	while true do
		task.wait(300)

		-- give them gold
		
		if check == false then
			break
		end
	end  
end)

game.Players.PlayerRemoving:Connect(function(player)
	check = false
end)