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

Math problem, how do I fix?

Asked by 8 years ago

So I got a small setup of when the block is touched it adds 1 to the block, but I had a problem occur that it skipped over the 20 mark, didn't go ah but when it got to 25, it went ahhh, how do I make it so I can go from 20 to 24 and still cause the reaction?

number1 = script.Parent.Name
number2 = 1;
number3 = 10;
number4 = 40;
number5 = 250;

debounce = false

function math()
    if script.Parent.Name == "20" then
    print"ah"
    end
end

function math2()
    if script.Parent.Name == "25" then
        print"ahhhh"
    end
end

(Note: I do plan on making the numbers bigger, so I would prefer something that could work for say... 1-100 as a variable.)

0
uhh, what YellowoTide 1992 — 8y
0
Here, if I have 20, and 25, How do I make 21, 22, 23, and 24 also be able to trigger the event that happens on 20. Mentalcase 35 — 8y
0
So if the bricks name is greater than or equal to 20 but less than 25 you want it to say "ah", but if the brick's name is 25 you want it to say "ahhhh"? TurboFusion 1821 — 8y
0
Yes. Mentalcase 35 — 8y
0
you can just use the tonumber(string) function which converts a string into a number and then do math operations on that TurboFusion 1821 — 8y

Answer this question