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

Mathmatical Multiple imputs, Help?

Asked by 8 years ago

Alright, Last post people got pissy and acted up by downvoting the question. Let's try this again. So here is what I'm trying to do, when this block is touched by anything it adds one to it's number which is the name of the block. (So I touch it once it becomes 1, touch again it becomes 2, ect.) I had an issue where I lagged in studio while standing on it, it went to 22 and console didn't say "Ahh". I tried to fix this issue but the error I get on line 21 is "expected 'then', got '=' ", How do I fix this? (To clarify, This is so that I can have the name be anywhere from 20 to 24 and still have the console say "Ahh") [I do plan or relaying out the table for all the math() related functions to deal with larger numbers, so me doing something like {if script.Parent.Name == "20,21,22,23,24" then} will only temporarily fix the issue]

number1 = script.Parent.Name
number2 = 1;
number3 = 10;
number4 = 40;
number5 = 250;
number6A = 20 --Math()Start
number6M = 24 --Math()Max
number7A = 25 --Math2()Start
number7M = 29 --Math2()Max
number8A = 30 --Math3()Start
number8M = 34 --Math3()Max
number9 = 35 --Math4()

debounce = false

function math()
    number1 = script.Parent.Name
    number6M = 24
    number6A = 20
    number7A = 25
    if number7A = number1 or number1 > number7A then   --Error on this line
        math2()
    elseif number6A = number1 or number6A < number1 then
       print"Ahh"
    end
    end
end

function math2()    --C'mon me, fix up that math() already.
    number1 = script.Parent.Name
    number7A = 25
    number7M = 29
    if number6A = number1 or number6A < number1 then
        print"Hey"
    end
end

function math3()
    if script.Parent.Name == "30" then
        print"Alert"
    end
end

function math4()
    if script.Parent.Name == "35" then
        print"I am die"
        wait(4)
        script.Parent.Parent = nil
    end
end

function onTouched()
    if debounce == true then return end
    debounce = true
    number1 = script.Parent.Name
    print(number1+number2) 
    script.Parent.Name = (number1+number2)
    wait(0.2)
    print "Tick"
    math()
    math2()
    math3()
    math4()
    debounce = false
end

script.Parent.Touched:connect(onTouched)

Watch someone downvotes this because they want to be a jerk.

0
Your problems is lines 21, 23, and 25; For 21 and 23, you set up an Invalid '='; '=' is to set a Value, '==' is to compare two Values; however, you have used '=', which is, as before explained, to set a Value, and the problem with 25 is that that is an extra end; It is not necessary. :P TheeDeathCaster 2368 — 8y
0
Also, a side note; Please use the 'Output' feature of the Studio; It usually detects problems like these. :) TheeDeathCaster 2368 — 8y
0
Appreciated, could you leave that as an answer so I can give you an upvote via answer? People keep downvoting me otherwise I'd do it here. Mentalcase 35 — 8y
0
Ok then.. TheeDeathCaster 2368 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

Requested by the Questioner

Your problems is lines 21, 23, and 25; For 21 and 23, you set up an Invalid '='; '=' is to set a Value (Variable = Value), '==' is to compare two Values (if Variable == Value); however, you have used '=', which is, as before explained, to set a Value, and the problem with 25 is that that is an extra end; It is not necessary. :P

Also, a side note; Please use the 'Output' feature of the Studio; It usually detects problems like these. :)

Hope this helped!

Ad

Answer this question