Hi! I’m making a game that counts how long it takes to complete an obstacle course. The problem is that my while loop won’t stop! Here’s the code I use (local script in starter player scripts):
local debounceTimerCount = true
local timeCheck = 0
local boolCheck = game.ReplicatedStorage["Start Game"].StartCharacterCheck.Value
game.ReplicatedStorage["Start Game"].OnClientEvent:Connect(function()
boolCheck = true
boolCheck = not boolCheck
timeCheck = 0
while not boolCheck do
if debounceTimerCount then
debounceTimerCount = not debounceTimerCount
timeCheck += 1
print(timeCheck)
wait(1)
debounceTimerCount = true
end
end
game.ReplicatedStorage.GameEnd.OnClientEvent:Connect(function()
boolCheck = true
game.ReplicatedStorage.TweenDetails:WaitForChild("SecondsTaken").Value = timeCheck
print(timeCheck)
game.ReplicatedStorage.TweenDetails:FireServer(workspace)
end)
end)
Thanks,
NeoGaming_RBLX