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

How do i enter various digits into an integer Value?

Asked by
Xianon 105
10 years ago

I want to enter several digits to an int Value in order to make an operation, my problem is that my script will only allow me to put in one digit, the problem is that i don't know how to do such function. Is for an Calculator.

local index = script.Parent.result  -- index is the TextLabel --
local in1 = script.Parent.in1  -- in1, in2, in3 are the TextButtons holding functions to input the values --
local in2 = script.Parent.in2
local in3 = script.Parent.in3
local in4 = script.Parent.in4
local in5 = script.Parent.in5
local in6 = script.Parent.in6
local in7 = script.Parent.in7
local in8 = script.Parent.in8
local in9 = script.Parent.in9
local inp = script.Parent.inp
local ins = script.Parent.ins
local ind = script.Parent.ind
local v1 = script.Parent.v1 -- v1 and v2 are my int values --
local v2 = script.Parent.v2
local b1 = script.Parent.v1.bvalue1 -- b1, b2, b3 etc, are my method to prevent inputing a value on an unwanted variable --
local b2 = script.Parent.v2.bvalue2
local b3 = script.Parent.inp.bvalue2
local b4 = script.Parent.ins.bvalue2
local b5 = script.Parent.ind.bvalue2
b1 = true
b2 = false
b3 = false
b4 = false
b5 = false



print("HardWare is available and Online") 


function onClick(in1)
    print("Click Detected")
    index.Text = ("1")
    if (b2 == true ) then
        v1.Value = ("1")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("1") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in1.MouseButton1Click:connect(onClick)

function onClick(in2)
    print("Click Detected")
    index.Text = ("2")
    if (b2 == true ) then
        v1.Value = ("2")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("2") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in2.MouseButton1Click:connect(onClick)

function onClick(in3)
    print("Click Detected")
    index.Text = ("3")
    if (b2 == true ) then
        v1.Value = ("3")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("3") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in3.MouseButton1Click:connect(onClick)

function onClick(in4)
    print("Click Detected")
    index.Text = ("4")
    if (b2 == true ) then
        v1.Value = ("4")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("4") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in4.MouseButton1Click:connect(onClick)


function onClick(in5)
    print("Click Detected")
    index.Text = ("5")
    if (b2 == true ) then
        v1.Value = ("5")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("5") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in5.MouseButton1Click:connect(onClick)

function onClick(in6)
    print("Click Detected")
    index.Text = ("6")
    if (b2 == true ) then
        v1.Value = ("6")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("6") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in6.MouseButton1Click:connect(onClick)

function onClick(in7)
    print("Click Detected")
    index.Text = ("7")
    if (b2 == true ) then
        v1.Value = ("7")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("7") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in7.MouseButton1Click:connect(onClick)

function onClick(in8)
    print("Click Detected")
    index.Text = ("8")
    if (b2 == true ) then
        v1.Value = ("8")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("8") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in8.MouseButton1Click:connect(onClick)

function onClick(in9)
    print("Click Detected")
    index.Text = ("9")
    if (b2 == true ) then
        v1.Value = ("9")
        b1 = true
        b2 = false
        print("Value Entered")
    elseif (b1 == true) then
        v2.Value = ("9") 
        b2 = true
        b1 = false
        print("Value Entered")

    end
end
in9.MouseButton1Click:connect(onClick)

0
I wonder why people are voting me down... Xianon 105 — 10y
0
Well, this is 193 lines. I didn't vote you down, but I recommend commenting where you believe the error is. Shawnyg 4330 — 10y

Answer this question