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

If statement not working correctly?

Asked by
wackem 50
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
01local b = script.Parent
02local guess = b.Parent.Guess
03local nums = {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}
04local plr = b.Parent.Parent.Parent.Parent
05local newNum = nums[math.random(1, #nums)]
06local round = 1
07local submitted = false
08local val = 1
09 
10b.MouseButton1Click:connect(function()
11submitted = true
12    if guess.Text == newNum then
13        b.Parent["Yes/No"].Text = "Correct!"
14        plr.Guesses.Value = plr.Guesses.Value + val
15    else
View all 31 lines...

All of that works but if I try and stop the changing of the values if the submitted is true it doesn't work. Help?

So I want to, basically, after they click once they can't click again, but when a new round starts, they can.

0
I'm not sure where you're getting at. Where is the "if" statement you're concerned about at in the script overall? Is it within a code block? If so, can you post the code block? Redbullusa 1580 — 9y
0
its at the end of the post. wackem 50 — 9y
4
That's not what I mean. Where in your actual script is the "if" statement located? Redbullusa 1580 — 9y
0
^ It's not. Please post your entire code Perci1 4988 — 9y
View all comments (2 more)
0
You need to post the entire code, not just the if statement, so we know exactly where we're looking and what's causing the error. Spongocardo 1991 — 9y
0
the if statement provided at the end belongs on line 20, sorry. wackem 50 — 9y

Answer this question