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

Local script not going all the way through?

Asked by 10 years ago

This local script is works perfectly fine until it is supposed to read what the textBox text is, it just does not do it and there is no error message.

local Player = game.Players.LocalPlayer -- for the key down events
local Mouse = Player:GetMouse()



local display = script.Parent

local BOOT_MSG_TEXT = "System booted, enter 'help' or run a command"

local lineNumber = 1

local tempInputBin = "empty" -- to hold the input from the player temporarley (not for coding)

returnPressed = false

function rButtonCheck(button)
    if button == "r" then
        print("player pressed return")
        returnPressed = true -- so the system knows that the user typed 'r'
        return
        else wait(1) 
    end

end


--functions that go into functions below



--functions that go into functions above
function help() -- prints dictionary

end
function signIn() --allows user to sign in

end

function readInput(linePath)
    while running == true do
    if readInput == (">")then
        wait(1)
    else
    local text = linePath
    tempInputBin = text.Text
    print(tempInputBin)
    running = false
    end
    end
end



-- functions below
function checkInput(inputOne,inputTwo,inputThree,funcOne,funcTwo,funcThree) -- checks up to three different answers then runs a function

if tempInputBin == inputOne then
    print("function one selected")
    funcOne()
elseif tempInputBin == inputTwo then
    print("function two selected")
    funcTwo()
elseif tempInputBin == inputThree then
    print("function three selected")
    funcThree()
    else print("invalid code entered")-- change to print on the cmd
end
end

function cmdWrite (text, name)--creates a label 
local linePos
linePos = lineNumber * 20
line = Instance.new("TextLabel", display)
line.BackgroundTransparency = 1
line.TextColor3 = Color3.new(255,255,255)
line.FontSize = ("Size18")
line.Font = ("Arial")
line.Size = UDim2.new(0,300,0,25)
line.Name = (name)
line.Text = (text)
line.Position = UDim2.new(0,0,0,linePos)
line.TextXAlignment = ("Left")
lineNumber = lineNumber + 1

end

function createNewInputLine(lineName)--moves the "cursor" down along with new text box
    local linePos
    linePos = lineNumber * 20--calculates pos
    line = Instance.new("TextBox", display)
    line.BackgroundTransparency = 1
    line.TextColor3 = Color3.new(255,255,255)
    line.FontSize = ("Size18")
    line.Font = ("Arial")
    line.Size = UDim2.new(0,300,0,25)
    line.Name = (lineName)
    line.Text = (">")
    line.Position = UDim2.new(0,0,0,linePos)
    line.TextXAlignment = ("Left")
    lineNumber = lineNumber + 1

end



--code to start
    bootMessage = Instance.new("TextLabel", display)
    bootMessage.BackgroundTransparency = 1
    bootMessage.TextColor3 = Color3.new(255,255,255)
    bootMessage.FontSize = ("Size18")
    bootMessage.Font = ("Arial")
    bootMessage.Size = UDim2.new(0,300,0,25)
    bootMessage.Name = ("bootMessage")--so we can remove it later
    bootMessage.Text = (BOOT_MSG_TEXT)
    bootMessage.TextXAlignment = ("Left")
    lineNumber = lineNumber + 1
-- ends here begin input

createNewInputLine("signInHelp")
Mouse.KeyDown:connect(rButtonCheck,button)
if returnPressed == true then -- seems to not work around here
    readInput(script.Parent.signInHelp)
    checkInput("help","sign in",nil,help(),signIn())
end

Answer this question