Hello, Its been a while since i visited here but my problem is i dont know how to increase a timer if the player clicks the gui button

I will give the server script service script and the gui button script

This is the server script service Script

game.Players.PlayerAdded:Connect(function(plr)

---RemoteEvents
local x2CRemEve = game.ReplicatedStorage.RemoteEvents.Booster.x2Boosters
local x5CRemEve = game.ReplicatedStorage.RemoteEvents.Booster.x5Boosters
	
---Leaderstats
local Coins = plr:WaitForChild("leaderstats").Coins
	
---Guis
local plrGui = plr:WaitForChild("PlayerGui")
local BoosterTimeFrame = plrGui:WaitForChild("Main").Booster
local BoosterFrame = game.ReplicatedStorage.Gui.BoosterFrame
local BoosterStillRemains = plrGui:WaitForChild("Main").BoosterStillRemains
	
x2CRemEve.OnServerEvent:Connect(function()
local Ifx2Boost = false
if Ifx2Boost == false then
	Coins.Value = Coins.Value -1000
	Ifx2Boost = true
	local x2BoostTimer = BoosterFrame:Clone()
	x2BoostTimer.Parent = BoosterTimeFrame
elseif Ifx2Boost == true then
	BoosterStillRemains.Visible = true
	 end
  end)

local Timer = BoosterFrame.Time
local minutes = 0
local seconds = 0
	
repeat
	if seconds <= 0 then
		minutes = minutes - 1
		seconds = 59
	else
		seconds = seconds - 1
	end
	if seconds <= 9  then
		Timer.Text = tostring(minutes)..":0"..tostring(seconds)
	else
		Timer.Text = tostring(minutes)..":"..tostring(seconds)
	end
	wait(1)
	until minutes <= 0 and seconds <= 0
	
end)

GUI button script

---Game
local RepStor = game.ReplicatedStorage
local BoosterShop = script.Parent.Parent.BoosterShop
local Booster = script.Parent.Parent.Booster
local plr = game.Players.LocalPlayer
local NotEnough = script.Parent.Parent.NotEnough

---Leaderstats
local Ls1 = plr.leaderstats.Clicks
local Ls2 = plr.leaderstats.Prestiges
local Ls3 = plr.leaderstats.Coins
local Ls4 = plr.leaderstats2.TimePlayed
---RemEve
local x2Boosters = RepStor.RemoteEvents.Booster.x2Boosters
local x5Boosters = RepStor.RemoteEvents.Booster.x5Boosters

---ClickBtn
local x2 = BoosterShop.ScrollFrame.x2Clicks.ClickBtn
local x5 = BoosterShop.ScrollFrame.x5Clicks.ClickBtn

x2.MouseButton1Click:Connect(function()
	if Ls3.Value >= 1000 then
		x2Boosters:FireServer()
	else
		NotEnough.Visible = true
		wait(1)
		NotEnough.Visible = false
	end
end)

--[[x5.MouseButton1Click:Connect(function()
	if Ls3.Value >= 5000 then
		x5Boosters:FireServer()
	else
		NotEnough.Visible = true
		wait(1)
		NotEnough.Visible = false
	end
end)
--]]

1 comment

0

ok