Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why doesn't this code change the bool value?

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.

3 comments

0

Where is the value located at?

0

ServerStorage

0

Ok! Did you create a variable for MatchActive?

1 answer

✓ Accepted answer

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)

2 comments

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!

0

Np! I'm so glad you can move on, exciting!!!

This discussion is preserved as it was. New answers, comments, and votes are closed.