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

Help With Key Byte?

Asked by 10 years ago

local Mouse = game.Players.LocalPlayer:GetMouse() bin = script.Parent

Mouse.KeyDown:connect(function(Key) if Key:lower() == "enter" then bin:CaptureFocus() end end)

-- I know I have this wrong but I'm not sure how to make it so when u press enter it will capture focus Help!?!?

0
Please put the script in a code block. EzraNehemiah_TF2 3552 — 10y
0
@iiNemo, come look at my script again, I edited it. EzraNehemiah_TF2 3552 — 10y

2 answers

Log in to vote
1
Answered by 10 years ago

There isn't really a way to check if a player pressed the enter button according to this chart. You could also do

string.byte(key) == 27 then --27 is the escape key on the keyboard.

But you can't really do an enter key.

EDIT

I just learned what Device Control is. The code for enter is 13.

string.byte(key) == 13 then --13 is the enter key on the keyboard.
0
Ik the codes but thanks for the info that I can't use the enter key that saved my time User#7446 0 — 10y
0
Your welcome. EzraNehemiah_TF2 3552 — 10y
Ad
Log in to vote
0
Answered by
Nexx 51
10 years ago

I don't know about what Lord said, but im pretty sure you can use the enter key. Do it like this and it will work

Mouse.KeyDown:connect(function(Key) 

    if Key:byte() == 13 then 
        bin:CaptureFocus() 
    end 

end)

Some keys dont have a string value, which is what :lower() if for. You can use :byte() for the number, so for this example, 13 = enter.

Good luck with it!

Answer this question