How to add billboard gui cooldown to money giver

Hi,

So I made a part that gives money every 5 minutes, but I want the remaining time to show on the billboard gui which I defined, but not sure how to make it work.

Any help is very much appreciated!

local db = true
local timedisplay = script.Parent.Timer.TextLabel

script.Parent.Touched:Connect(function(hit) 
	if db == true then
		
		if hit.Parent:FindFirstChild("Humanoid") then
			db = false
			local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
			plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value + 50	
			wait(10) 
			db = true 
		end
	end
end)
local Time = 10 --// Time it takes to reset the timer

local db = 0
local timedisplay = script.Parent.Timer.TextLabel

script.Parent.Touched:Connect(function(hit) 
	if db == 0 then

		if hit.Parent:FindFirstChild("Humanoid") then
			
			task.spawn(function()
				db = Time
				for i = 1, Time do 
					task.wait(1)
					db -= 1 
					timedisplay.Text = tostring(db)
				end 
			end)
			
			local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
			plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value + 50	
		end
	end
end)
2 Likes

Thank you so much!!! It’ works perfectly! :smiley:

1 Like