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

Is this the right way to use if function?

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"

5 comments

1

You forgot a then

0

where should the then be

0

where should the then be

1

After 10 (not line 10)

0

Thx

1 answer

✓ Accepted answer

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"

9 comments

0

Wrong he simply forgot and end

0

Lol u edited

0

Thx ill try it

0

Thx ill try it

0

Glad I could hlp

0

This script didn't work

1

what error does it show

0

It works now thx

0

Can you accept this answer then

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