|
I can't find Numbers in the Key bindings list... |
|
smiley599Join Date: 2010-01-23 Post Count: 21869 |
mouse.KeyDown:connect(function(key)
if type(tonumber(key))=="Number" then
? Idk |
|
smiley599Join Date: 2010-01-23 Post Count: 21869 |
Or you could make a function like
for k=1,string.len(key) do
if k=="1" or k == "2" or --etc etc all the way to 9 and 0
then print'ok'
else
break
Or return true if all keys are 1 or 2 Etc |
|
|
|
while wait() do
for c,v in pairs(game.Players:GetChildren()) do
Mouse = v:GetMouse()
Mouse.KeyDown:connect(function(Key)
if Key == "NumberKeyHere" then
--Code Here
end
end)
end
end
This would create an infinite loop which would constantly. check if that specific number key is being pressed. |
|
smiley599Join Date: 2010-01-23 Post Count: 21869 |
Anony that cannot work. |
|
|
@Anony,
You can detect numbers with strings... |
|
|
|
|
if key == "1" then
print("'1' was pressed. If this does not work, ROBLOX does not allow it.")
end |
|
GoulstemJoin Date: 2012-07-04 Post Count: 7177 |
OMFG STRING.BYTE
keyz = {"48","49","50","51","52","53","54","55","56","57"}
mouse.KeyDown:connect(function(key)
key = key:lower():byte()
for i = 1,#keyz do
if a = true then
if keyz[i]:match(tostring(key)) then
print("KEY FOUND, IZA NUMBRE")
end end end end) |
|
GoulstemJoin Date: 2012-07-04 Post Count: 7177 |
Sowwy typo
keyz = {"48","49","50","51","52","53","54","55","56","57"}
mouse.KeyDown:connect(function(key)
key = key:lower():byte()
for i = 1,#keyz do
if keyz[i]:match(tostring(key)) then
print("KEY FOUND, IZA NUMBRE")
end end end) |
|
|
@Goulstem@
if key == "1" then
No need for byte :) |
|
GoulstemJoin Date: 2012-07-04 Post Count: 7177 |
That doesn't work, just tested it. |
|
|
Works for me (In Studios, probably wont work online unless they fixed that)
Code:
game.StarterGui:SetCoreGuiEnabled("All", false) game.Players.LocalPlayer:GetMouse().KeyDown:connect(function(k) print(k) end)
>1
>2
>3 |
|