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 4 years ago
local b = game.Workspace.Hello.Value
local h = true
h = true if b == 10
else h == false



    while h == true do
        wait(40)
        script.Parent.Text = "20"
1
You forgot a then JesseSong 3916 — 4y
0
where should the then be FluffySheep46209 369 — 4y
0
where should the then be FluffySheep46209 369 — 4y
1
After 10 (not line 10) JesseSong 3916 — 4y
0
Thx FluffySheep46209 369 — 4y

1 answer

Log in to vote
1
Answered by
AM910sk 22
4 years ago
Edited 4 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:

local b = game.Workspace.Hello.Value
local h = true

if b == 10 then
    h = true
else
    h == false
end

while h == true do
        wait(40)
end
 script.Parent.Text = "20"
0
Wrong he simply forgot and end JesseSong 3916 — 4y
0
Lol u edited JesseSong 3916 — 4y
0
Thx ill try it FluffySheep46209 369 — 4y
0
Thx ill try it FluffySheep46209 369 — 4y
View all comments (5 more)
0
Glad I could hlp AM910sk 22 — 4y
0
This script didn't work FluffySheep46209 369 — 4y
1
what error does it show AM910sk 22 — 4y
0
It works now thx FluffySheep46209 369 — 4y
0
Can you accept this answer then AM910sk 22 — 4y
Ad

Answer this question