menu
Roblox Forum Archive
Home
User Search
Forums
Donate
search
settings
Home
User Search
Forums
Donate
launch
Go to User Dashboard
Forums
Scripting Helpers
Help Binding Keys to a Script
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right
Help Binding Keys to a Script
UnforeseenVice
Join Date: 2009-03-27
Post Count: 1078
#141291008
Wednesday, July 23, 2014 5:57 PM GMT
I just need help as to how i would go about pressing a key to start a script then if i press another key it stops it. :P New to Lua
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
128GB
Join Date: 2014-04-17
Post Count: 8056
#141291097
Wednesday, July 23, 2014 5:58 PM GMT
The .KeyDown event, from a local script
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
domorox17
Join Date: 2012-03-06
Post Count: 1710
#141291180
Wednesday, July 23, 2014 5:59 PM GMT
In a localscript, preferably in StarterPack p = game.Players.LocalPlayer m = p:GetMouse() m.KeyDown:connect(function(key) if key == 'keyhere' then --code elseif key == 'otherkeyhere' then --morecode end end)
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
HuntHello
Join Date: 2011-01-19
Post Count: 577
#141291221
Wednesday, July 23, 2014 6:00 PM GMT
Or you can connect the event to everyone with playeradded
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
UnforeseenVice
Join Date: 2009-03-27
Post Count: 1078
#141291280
Wednesday, July 23, 2014 6:00 PM GMT
Thanks, but i have no clue how to incorperate that to my script :/
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
DeviousDeviation
Join Date: 2010-12-28
Post Count: 9306
#141291290
Wednesday, July 23, 2014 6:00 PM GMT
game:GetService("ContextActionService"):BindActionToInputTypes("Name", functionToBind, false, Enum.KeyCode.E) owait im a hypocrite
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
128GB
Join Date: 2014-04-17
Post Count: 8056
#141292111
Wednesday, July 23, 2014 6:09 PM GMT
Or you can connect the event to everyone with playeradded No you can't, KeyDown only works from localscripts
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
HuntHello
Join Date: 2011-01-19
Post Count: 577
#141292474
Wednesday, July 23, 2014 6:13 PM GMT
128 oh yeah, nvm with that (haven't used in a while )
Go to point in time
arrow_right
10 minutes before
5 minutes before
At time of posting
5 minutes after
10 minutes after
more_horiz
chevron_left
chevron_left
chevron_left
of
1
chevron_right
chevron_right
chevron_right