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

Why does this script skip over the 'if' statement?

while wait() do
	if script.Parent.Parent.BombTime.Value ~= "120" then
		script.Parent.Script1.Disabled = true
		script.Parent.Script2.Disabled = true
	end
end

It basically disregards the 'if' statement and immediately disables the scripts.

2 comments

0

Why is 120 in ""?

3

FYI -- Normally Disabled isn't the right way to go about starting/stopping scripts. It's often, but not always, cleaner for the scripts to manage it themselves explicitly

2 answers

First of all, to check if a value is a int value don't put quotation marks around the number. Second, which you might already know, ~= means that you're checking if its NOT that number. Just remove the quotation marks around the 120. Good luck (:

2 comments

1

Those are not parentheses...

0

Now I look stupid

So your script is this:

while wait() do
    if script.Parent.Parent.BombTime.Value ~= "120" then
        script.Parent.Script1.Disabled = true
        script.Parent.Script2.Disabled = true
    end
end

You should be using int/number values for numbers, therefore no quotation marks are needed. If your value is int/number your script should be this:

while wait() do
    if script.Parent.Parent.BombTime.Value ~= 120 then
        script.Parent.Script1.Disabled = true
        script.Parent.Script2.Disabled = true
    end
end

Hope this helps :) -ElmEditor (If this did help please press the ^ button, it motivates me to continue helping scripters)

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