IronNoob

Please login or register.

Login with username, password and session length
Advanced search  

News:

Migrated to dedicated hosting. Post any weirdness you observe in the Lounge.

Author Topic: Detecting non-WASD button presses without a tool?  (Read 135 times)

0 Members and 1 Guest are viewing this topic.

madattak

  • Hero Member
  • *****
  • Online Online
  • Posts: 3317
  • FOR SCIENCE!
    • View Profile
Detecting non-WASD button presses without a tool?
« on: April 09, 2013, 04:59:46 am »

Im working on a rally 'Simulator' (It ain't really) and I want it to include a manual gear box, but I dont want to use a tool since you then have to explain about selecting it, which some people on ROBLOX just dont understand (You'd be suprised) and then making it appear and disappear without breaking etc.

So can I detect Q and E presses without a tool?
Logged

CAUTION: Tap water may contain high levels of dihydrogen monoxide.

BAUER102

  • Full Member
  • ***
  • Offline Offline
  • Posts: 199
  • Full-time God
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #1 on: April 09, 2013, 07:37:13 am »

Player :: GetMouse
Logged
German Coding Maniac
Main Twitter || Borderline Twitter || ROBLOX Account

madattak

  • Hero Member
  • *****
  • Online Online
  • Posts: 3317
  • FOR SCIENCE!
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #2 on: April 09, 2013, 07:55:05 am »

Player :: GetMouse

Can you maybe explain that statement further?
Logged

CAUTION: Tap water may contain high levels of dihydrogen monoxide.

BAUER102

  • Full Member
  • ***
  • Offline Offline
  • Posts: 199
  • Full-time God
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #3 on: April 09, 2013, 07:59:03 am »

player:GetMouse().KeyDown:connect(function(key) end)

praise the wiki
Logged
German Coding Maniac
Main Twitter || Borderline Twitter || ROBLOX Account

um3k

  • Full Member
  • ***
  • Offline Offline
  • Posts: 101
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #4 on: April 09, 2013, 03:52:17 pm »

I use player:GetMouse() profusely in Zombiesdale, as well as the submarines in BattleBoats. It works just the same as a tool mouse, but needs no tool to function.
Logged

MaximMike

  • Newbie
  • *
  • Offline Offline
  • Posts: 3
  • Even if I'm away, I'm still watching.
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #5 on: April 16, 2013, 08:03:03 am »

1. Insert a LocalScript into PlayerGui or StarterPack.
2. Write this inside the script:

Code: [Select]
function keydown(key)
  if key == "b" then
    print'b was pressed'
  end
end

game.Players.LocalPlayer:GetMouse().KeyDown:connect(keydown)

This is the easiest way I currently know.

Also, if you want to know about making checkpoints that only a single person can see (client-side checkpoints), then see my post on Roblox.com
http://www.roblox.com/Forum/ShowPost.aspx?PostID=94288510
« Last Edit: April 16, 2013, 08:06:17 am by MaximMike »
Logged

Darkeness

  • Newbie
  • *
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #6 on: April 17, 2013, 01:14:34 pm »

player:GetMouse().KeyDown:connect(function(key) end)

praise the wiki
Logged
~~~~~~~~~~~~~~~~
I may be a Mobster
But I was a Hero
~~~~~~~~~~~~~~~~

Arclordrpg

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 413
  • Made of Pixels
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #7 on: April 21, 2013, 07:06:57 pm »

player:GetMouse().KeyDown:connect(function(key) end)

praise the wiki

How about you start using it.  :)
Logged

Darkeness

  • Newbie
  • *
  • Offline Offline
  • Posts: 21
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #8 on: April 21, 2013, 07:31:31 pm »

player:GetMouse().KeyDown:connect(function(key) end)

praise the wiki

How about you start using it.  :)

I do on certain tricks on scripting.
Logged
~~~~~~~~~~~~~~~~
I may be a Mobster
But I was a Hero
~~~~~~~~~~~~~~~~

Arclordrpg

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 413
  • Made of Pixels
    • View Profile
Re: Detecting non-WASD button presses without a tool?
« Reply #9 on: April 22, 2013, 06:36:45 pm »

I do on certain tricks on scripting.

Is it going on IronNoob for scripting help and getting a block of code here?
Logged
 

Page created in 0.108 seconds with 22 queries.