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 » Scripters
Home Search
 

Re: My friend matteice321 and I have been working on this,

Previous Thread :: Next Thread 
Xucs is not online. Xucs
Joined: 23 Jul 2010
Total Posts: 11844
21 May 2015 01:32 PM
Both of us are fairly new to scripting, and even newer to keydown functions.
I know how to check if a key is pressed;
while key:lower"x" or something, but how would you change this into being WHILE shift is being held, this is happening.


mouse.KeyDown:connect(function(key)
if key:lower()=="x" then --This is where it needs to be changed, I believe.
wait(.1)

This is a fragment of the script, it won't allow me to post the whole thing.



Leveraged/tixmaker101 + 55k posts |
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 May 2015 01:35 PM
mouse = game.Players.LocalPlayer:GetMouse()

mouse.KeyDown:connect(function(key)
if key:lower() == "x" then
--enable what to happen
end
end)

mouse.KeyUp:connect(function(key)
if key:lower() == "x" then
--disable what to happen
end
end)
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
21 May 2015 01:35 PM
local shift = false
local uis = game:GetService("UserInputService")

uis.InputBegan:connect(function(key)
if key.KeyCode = Enum.KeyCode.Shift then
shift = true
end
end)

uis.InputEnded:connect(function(key)
if key.KeyCode = Enum.KeyCode.Shift then
shift = false
end
end)

function doStuff()
--Do stuff while shift is held
end

while wait() do
if shift then repeat doStuff() wait() until not shift end
end

~ᵂʰᵒ ᵃʳᵉ ʸᵒᵘ ᵗᵒᵈᵃʸ﹖~
Report Abuse
Fedorakid is not online. Fedorakid
Joined: 17 Jul 2010
Total Posts: 7079
21 May 2015 01:36 PM
or just listen to that guy above me

ive quit roblox
Report Abuse
Xucs is not online. Xucs
Joined: 23 Jul 2010
Total Posts: 11844
21 May 2015 01:37 PM
Thanks.

We've been reading wiki articles, and didn't understand it.

Any chance you guys could post an informative link on keydowns?



Leveraged/tixmaker101 + 55k posts |
Report Abuse
Intern33t is not online. Intern33t
Joined: 19 Nov 2010
Total Posts: 1530
21 May 2015 01:38 PM
Please dont use the mouse object.
Also not KeyDown and KeyUp.

Use UserInputService.

http://wiki.roblox.com/index.php?title=UserInputService

~ᵂʰᵒ ᵃʳᵉ ʸᵒᵘ ᵗᵒᵈᵃʸ﹖~
Report Abuse
eLunate is not online. eLunate
Joined: 29 Jul 2014
Total Posts: 13268
21 May 2015 01:38 PM
http://www.roblox.com/Valkyrie-Binds-Manager-item?id=235385848

local binds = require(thatThing)
binds:BindInputDown('x', function(iData)
while iData.Down and binds.Keys.Shift.Down do
-- Do something
end
end);
Report Abuse
Accomplishable is not online. Accomplishable
Joined: 13 Aug 2009
Total Posts: 6207
21 May 2015 02:14 PM
"Please dont use the mouse object."

No. Just no. UIS isn't good enough to entirely replace every single feature of the mouse. (yet)
Report Abuse
TheCreationWorld is not online. TheCreationWorld
Joined: 02 Nov 2014
Total Posts: 568
21 May 2015 02:18 PM
mouse = plr:GetMouse()
keysdown = {}

mouse.KeyDown:connect(function(key)
keysdown[key] = true
end)

mouse.KeyUp:connect(function(key)
keysdown[key] = false
end)

while keysdown["w"] do
print("you're holding w hurray!")
end
Report Abuse
UnDeFeatedVibe is not online. UnDeFeatedVibe
Joined: 16 Jun 2011
Total Posts: 10
30 Sep 2015 10:41 PM
HMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM...
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
30 Sep 2015 10:56 PM
You could use this in a local script

local uI = game:GetService("UserInputService")

game:GetService("RunService"):BindToRenderStep("Name", Enum.RenderPriority.Input.Value,
function()
if(uI:IsKeyDown(Enum.KeyCode.RightShift) or uI:IsKeyDown(Enum.KeyCode.RightShift)) then
-- Code here
end
end)
Report Abuse
earthyreuben is not online. earthyreuben
Joined: 17 Jan 2010
Total Posts: 669
30 Sep 2015 10:57 PM
I meant to put Enum.KeyCode.LeftShift instead of RightShift twice
Report Abuse
Poseidas is not online. Poseidas
Joined: 23 Nov 2008
Total Posts: 2659
01 Oct 2015 12:52 AM
"UIS isn't good enough to replace the mouse"

ha. Okay.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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