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

Why isn't this keyboard input line of code working?

Asked by
Txngo 5
9 years ago

Basically all I want it to do is add 1 to the value of power when one of the shift buttons are pressed yes I have called the mouse. Help please?

function powers(key)
    print("KEY DOWN"..key)  

    if key == "q" then

    end
    if key == "e" then

    end
    if string.byte(key) == 017 or 016 then
        while wait() do 
            if power.Value ~= 100 then
                power.Value = power.Value +1
            end
        end
    end
end
mouse.KeyDown:connect(powers)

1 answer

Log in to vote
2
Answered by
RedCombee 585 Moderation Voter
9 years ago

On line 10, nice try. You can't do this:

if string.byte(key) == 017 or 016 then -- You have to restate the statement.

Correct:

if string.byte(key) == 017 or string.byte(key) == 016 then 
Ad

Answer this question