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
 

Re: Key hold?

Previous Thread :: Next Thread 
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
31 Jan 2013 05:16 PM
local player = game.Players.LocalPlayer;
player:GetMouse().KeyDown:connect(function (key)
if key:hold() == "Shift" then
player.Character.Walkspeed = 19
end
end)

I tryed to make like a run script, as you can see it didnt work out..
I wanted it to do like if someone holds down Shift then they will start to run
When they let go it will go back to 16
I am not a very Good scripter, please help!
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
31 Jan 2013 05:19 PM
local player = game.Players.LocalPlayer;
player:GetMouse().KeyDown:connect(function (key)
if key == "Shift" then
player.Character.Walkspeed = 19
end
end)
player:GetMouse().KeyUp:connect(function (key)
if key == "Shift" then
player.Character.Walkspeed = 16
end
end)
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
31 Jan 2013 05:20 PM
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()


Mouse.KeyDown:connect(function(Key)
if Key:byte() == 48 then
Player.Character.Humanoid.Walkspeed = 19;
end
end

Mouse.KeyUp:connect(function(Key)
if Key:byte() == 48 then
Player.Character.Humanoid.Walkspeed = 16;
end
end
Report Abuse
YellowBrick1 is not online. YellowBrick1
Joined: 06 May 2009
Total Posts: 865
31 Jan 2013 05:23 PM
@Quenty, you should also include :byte() == 47, that also represents shift.
Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
31 Jan 2013 05:26 PM
True. I recently posted this list (Like, 1 hour ago)

http://www.roblox.com/Forum/ShowPost.aspx?PostID=88198480

For the script I was writing that uses it. :)
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
31 Jan 2013 05:31 PM
Nothing worked :/
I tryed em both, and edited em to when they first did'nt work.
Report Abuse
TehMostEpicPwner is not online. TehMostEpicPwner
Joined: 20 Aug 2012
Total Posts: 226
31 Jan 2013 05:37 PM
Got it nvm

local mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function (key)
for i, v in pairs(game.Players:GetChildren()) do
if key == "q" then
v.Character.Humanoid.WalkSpeed = 25
print("Walkspeed = 25")
end
mouse.KeyUp:connect(function (key)
if key == "q" then
v.Character.Humanoid.WalkSpeed = 16
print("Walkspeed = 16")
end
end)
end
end)

Report Abuse
Quenty is not online. Quenty
Joined: 03 Sep 2009
Total Posts: 9316
31 Jan 2013 05:39 PM
Lol. We forgot ending ), and key:byte() was probably wrong.
Report Abuse
xXxBOiL3DxXx is not online. xXxBOiL3DxXx
Joined: 08 Sep 2012
Total Posts: 110
08 Feb 2014 12:16 AM
I dont get it. what is byte?
Report Abuse
dodleman is not online. dodleman
Joined: 22 Dec 2007
Total Posts: 1118
08 Feb 2014 12:17 AM
Dude this post is over a year old, just post a new thread instead of bumping one idiot.

Life is potatoes to me
Report Abuse
Scumbob is not online. Scumbob
Joined: 13 Oct 2012
Total Posts: 342
15 Nov 2014 03:27 PM
potato
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