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

Why doesn't this code change the bool value?

Asked by 4 years ago

Basically, I'm trying to check if there's one player left in a round by using the MatchActive value to check if the match is currently underway. The only problem is, this code doesn't change the value of MatchActive. At first, I just tried using MatchActive, then I switched to MatchActive.Value and it still doesn't work. Any suggestions?

MatchStart.Event:Connect(function()
    local MatchState = MatchActive.Value
    MatchState = true
    print(MatchState)
end)

MatchEnd.Event:Connect(function()
    local MatchState = MatchActive.Value
    MatchState = false
    print(MatchState)
end)

I set MatchState to false before the game. I am using a constantly running print statement to monitor it, and it remains false.

0
Where is the value located at? Moom_RBLX 30 — 4y
0
ServerStorage 2160grb 2 — 4y
0
Ok! Did you create a variable for MatchActive? Moom_RBLX 30 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Oh, also, you could just make one bindable and pass arguments through it. Instead of having two binds.

Example:

local MatchController = Where ever the bind is located in.

MatchController.Event:Connect(function(argument)
    MatchActive.Value = argument
    print(MatchActive.Value)
end)
0
I got logged out so sorry that it took such a long time to reply. It actually worked! Now I can start work on the next part of my game, thanks! 2160grb 2 — 4y
0
Np! I'm so glad you can move on, exciting!!! Moom_RBLX 30 — 4y
Ad

Answer this question