Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

script not detecing bool value change?

Asked by 3 years ago
Edited 3 years ago
local repstore = game:GetService("ReplicatedStorage")
local playercount = repstore.playercount
local status = repstore.status
local inRound = repstore.inRound
local vote = repstore.vote
local time = 10

local players = game:GetService("Players")

local function playerCounter()
    wait()
    if players.PlayerAdded then
        playercount.Value = playercount.Value + 1
    elseif players.PlayerRemoving then
        playercount.Value = playercount.Value - 1

    end
end
playerCounter() -- ignore this playercounter, I will be using it later on.

local function timer()
    for i = time, 1, -1 do
        wait(1)
        status.Value = "Intermission: " .. i .. " Seconds Left"
    end
    wait()
    inRound.Value = true
end

--start
if inRound.Value == false then 
        timer()
    end
    if inRound.Value == true then
        return
    end
--  end : im using this section just for the initial start of the game, ill be using my playercounter 
-- later on; like 2 people are needed to start, etc.

inRound:GetPropertyChangedSignal("Value"):Connect(function() 
    while wait() do
    if inRound.Value == false then
        timer()
        end
    if inRound.Value == true then
            return
        end
    end
end) -- here is where i tried to repeat the timer but it just doesnt work

as the title suggests, the timer() starts, but after it ends it doesn't restart. I've tried other ways to detect it (tell me if u need them) but it doesn't detect those either.

0
I don't really understand. You made it so that inRound.Value is true after starting the timer, therefore the changed event won't do anything. Neatwyy 123 — 3y
0
No the problem is that the script doesnt update when the boolvalue changes. I even tried it with a print function, so that every time the boolvalue becomes false or true it prints "working", that still didn't work. So I don't even know how to fix this anymore vNLegacy 9 — 3y

Answer this question