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

Is this the right way to use if function?

Asked by 5 years ago
01local b = game.Workspace.Hello.Value
02local h = true
03h = true if b == 10
04else h == false
05 
06 
07 
08    while h == true do
09        wait(40)
10        script.Parent.Text = "20"
1
You forgot a then JesseSong 3916 — 5y
0
where should the then be FluffySheep46209 369 — 5y
0
where should the then be FluffySheep46209 369 — 5y
1
After 10 (not line 10) JesseSong 3916 — 5y
0
Thx FluffySheep46209 369 — 5y

1 answer

Log in to vote
1
Answered by
AM910sk 22
5 years ago
Edited 5 years ago

Yes but No you should use an if statement in a different line

and change the value of h inside the if statement and remove "h = true" outside the if statement

also, put a then after the if statement

You should also have an "end" at the end of a while loop.

You also forgot an end at the end of your if statement like so

Like this:

01local b = game.Workspace.Hello.Value
02local h = true
03 
04if b == 10 then
05    h = true
06else
07    h == false
08end
09 
10while h == true do
11        wait(40)
12end
13 script.Parent.Text = "20"
0
Wrong he simply forgot and end JesseSong 3916 — 5y
0
Lol u edited JesseSong 3916 — 5y
0
Thx ill try it FluffySheep46209 369 — 5y
0
Thx ill try it FluffySheep46209 369 — 5y
View all comments (5 more)
0
Glad I could hlp AM910sk 22 — 5y
0
This script didn't work FluffySheep46209 369 — 5y
1
what error does it show AM910sk 22 — 5y
0
It works now thx FluffySheep46209 369 — 5y
0
Can you accept this answer then AM910sk 22 — 5y
Ad

Answer this question