generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Keydown

Previous Thread :: Next Thread 
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 05:29 PM
function speedgear(key)
if key == "e" and script.Parent.GearLevel.Value ~= 5 then
script.Parent.GearLevel.Value = script.Parent.GearLevel.Value+1
elseif key == "q" and script.Parent.GearLevel.Value ~= 0 then
script.Parent.GearLevel.Value = script.Parent.GearLevel.Value-1
end
end

So basically whenever I press a key it thinks its q and subtracts one?

Any key I press.
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
15 Sep 2014 05:51 PM
I fixed what I could find, but I don't see your problem.
Your problem is probably not in this section of code.

function SpeedGear(Key)
if Key:lower() == "e" and script.Parent.GearLevel.Value <= 4 then
script.Parent.GearLevel.Value = script.Parent.GearLevel.Value + 1
elseif Key:lower() == "q" and script.Parent.GearLevel.Value >= 1 then
script.Parent.GearLevel.Value = script.Parent.GearLevel.Value - 1
end
end
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 06:04 PM
Bump
Report Abuse
Bobobob12 is not online. Bobobob12
Joined: 23 Jan 2008
Total Posts: 5350
15 Sep 2014 06:05 PM
post where speedgear is called
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 06:20 PM
As this is connected to my old script

function test(hit)
if game.Players:GetPlayerFromCharacter(hit.Parent) then
local speed1 = math.floor(script.Parent.Velocity.magnitude)
test1 = true
player = game.Players:GetPlayerFromCharacter(hit.Parent)
mouse = player:GetMouse()
speed()
gear()
mouse.KeyDown:connect(speedgear)
end
end

Gets called through my test function which is ran by script.Parent.Touched:connect(test)
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 06:42 PM
Bump
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 07:08 PM
Bump
Report Abuse
SuperSniper222 is not online. SuperSniper222
Joined: 09 Jul 2010
Total Posts: 426
15 Sep 2014 07:35 PM
Bump
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image