My timer is not starting, if statement is not working

  1. What do you want to achieve? So I want the timer to start when I say game.ReplicatedStorage.StartTimer.Value = true

  2. What is the issue? The issue is that it’s not wanting to start the timer even tho the value == true

  3. What solutions have you tried so far? I have tried to look everywhere but did not find anything that works. I also tried to use debounce but it was still not working.

Scripts: ServerScriptService
BoolValue: ReplicatedStorage

FightingArena.TPDetector.ProximityPrompt.Triggered:Connect(function(player)
	FightingArena.TPDetector.Sound:Play()
		
	local NotifyGui = game.ServerStorage.NotifyGui:Clone()
	NotifyGui.Parent = player.PlayerGui
	
	wait(5)
	
	player.Character.Torso.CFrame = CFrame.new(-6410.515, 37.741, -1648.417)	
	player.PlayerGui.NotifyGui:Destroy()
	
	wait(1.5)

	local Sword = game.ServerStorage.ClassicSword:Clone()
	Sword.Parent = player.Backpack
	
	if game.ReplicatedStorage.StartTimer.Value == false then
		game.ReplicatedStorage.StartTimer.Value = true
		print("Timer has been called.")
	end
end)
local Main = game.Workspace.FightingArena.WaitingRoom.Text.Label

while wait() do
	if game.ReplicatedStorage.StartTimer == true then
		print("Timer has started.")
		Main.Text = "Waiting for players."
		wait(1)
		Main.Text = "Waiting for players.."
		wait(1)
		Main.Text = "Waiting for players..."
		wait(1)
		Main.Text = "Waiting for players."
		wait(1)
		Main.Text = "Next Match: 15"
		wait(1)
		Main.Text = "Next Match: 14"
		wait(1)
		Main.Text = "Next Match: 13"
		wait(1)
		Main.Text = "Next Match: 12"
		wait(1)
		Main.Text = "Next Match: 11"
		wait(1)
		Main.Text = "Next Match: 10"
		wait(1)
		Main.Text = "Next Match: 9"
		wait(1)
		Main.Text = "Next Match: 8"
		wait(1)
		Main.Text = "Next Match: 7"
		wait(1)
		Main.Text = "Next Match: 6"
		wait(1)
		Main.Text = "Next Match: 5"
		wait(1)
		Main.Text = "Next Match: 4"
		wait(1)
		Main.Text = "Next Match: 3"
		wait(1)
		Main.Text = "Next Match: 2"
		wait(1)
		Main.Text = "Next Match: 1"
		wait(1)
		Main.Text = "Fight!"
		wait(1)
		game.Workspace.FightingArena.WaitingRoom.CanCollide = false
		wait(3)
		game.Workspace.FightingArena.WaitingRoom.CanCollide = true
		game.ReplicatedStorage.StartTimer.Value = false
		Main.Text = ""
		print("Timer has ended.")
	end
end
local Main = game.Workspace.FightingArena.WaitingRoom.Text.Label

while wait() do
	if game.ReplicatedStorage.StartTimer == true then
		print("Timer has started.")
		Main.Text = "Waiting for players."
		wait(1)
		Main.Text = "Waiting for players.."
		wait(1)
		Main.Text = "Waiting for players..."
		wait(1)
		Main.Text = "Waiting for players."
		wait(1)
		for i=15,1,-1 do
			Main.Text = "Next Match: "..i
			wait(1)
		end
		Main.Text = "Fight!"
		wait(1)
		game.Workspace.FightingArena.WaitingRoom.CanCollide = false
		wait(3)
		game.Workspace.FightingArena.WaitingRoom.CanCollide = true
		game.ReplicatedStorage.StartTimer.Value = false
		Main.Text = ""
		print("Timer has ended.")
	end
end

and if statement looks good maybe its cause you didnt set it to true

It’s still not working… -----------------------

are you making the game.ReplicatedStorage.StartTimer to true?

Oh, wait a second. --------------------

I’m not sure about this, and I can’t be bothered to write a code but maybe do like

game.ReplicatedStorage.StartTimer:GetPropertyChangedSignal("Value"):Connect(function()
if game.ReplicatedStorage.StartTimer.Value == true then
-- your code here
end)

BRUH! Is it only me or I forgot to put StartTimer.Value

Nvm, it worked. Thank you so much, I have been trying to fix this for like 3-4 hours.

1 Like

well welcome and good luck on your game!

1 Like