Welcome, Guest |
You have to register before you can post on our site.
|
Forum Statistics |
» Members: 8,079
» Latest member: seanac11
» Forum threads: 10,350
» Forum posts: 91,276
Full Statistics
|
Online Users |
There are currently 233 online users. » 0 Member(s) | 231 Guest(s) Bing, Google
|
Latest Threads |
I'm leaving the site too....
Forum: 2DWorlds Discussion
Last Post: Jacob_
07-03-2023, 04:59 AM
» Replies: 12
» Views: 6,254
|
hi there.
Forum: 2DWorlds Discussion
Last Post: Jacob_
01-03-2020, 04:30 AM
» Replies: 1
» Views: 727
|
obroke
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 10:11 AM
» Replies: 0
» Views: 20,516
|
fcouldn't
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 09:02 AM
» Replies: 0
» Views: 8,224
|
qhow
Forum: Current Games
Last Post: PhilipShums
09-06-2017, 07:25 AM
» Replies: 0
» Views: 2,105
|
zstone
Forum: Current Games
Last Post: TimothyTox
09-06-2017, 07:03 AM
» Replies: 0
» Views: 971
|
vbit
Forum: Current Games
Last Post: FrancisSah
09-06-2017, 03:00 AM
» Replies: 0
» Views: 950
|
sildenafil 100 mg sandoz
Forum: Current Games
Last Post: RichardLen
09-06-2017, 12:28 AM
» Replies: 0
» Views: 1,161
|
mhis
Forum: Current Games
Last Post: TimothyTox
09-05-2017, 04:09 PM
» Replies: 0
» Views: 978
|
sildenafil citrate 100mg ...
Forum: Current Games
Last Post: Waltertog
09-05-2017, 12:27 PM
» Replies: 0
» Views: 934
|
|
|
Easy key events in tools |
Posted by: toast - 04-10-2011, 03:32 AM - Forum: Tutorials and Guides
- Replies (1)
|
 |
Here is some code to make key controls easier to work with in a tool.
This will be placed in a script inside a Tool
[lua]local keys={}
function iskeydown(k)
for i,v in pairs(keys) do
if v==k then return true end
end
return false
end
function keydown(k)
if not iskeydown(k) then
table.insert(keys,k)
end
end
function keyup(k)
if iskeydown(k) then
local ind=0
for i,v in pairs(keys) do
if v==k then ind=i end
end
table.remove(keys,ind)
end
end
link(script.Parent.KeyDown,keydown)
link(script.Parent.KeyUp,keyup)[/lua]
With this code you ca later say
[lua]if iskeydown("KEY HERE") then[/lua]
To see if that key is currently being pressed.
|
|
|
|