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: Do I use a LocalScript to use KeyDown inside of a tool?

Previous Thread :: Next Thread 
GliconCraft is not online. GliconCraft
Joined: 17 Dec 2015
Total Posts: 99
18 Jan 2016 04:52 PM
I'm making a tool that will help you create small regions of water using the Q and E buttons to mark your region. I know that when you're using a local script to use the KeyDown event, you it's an event of the player's mouse, but do I have to use :GetMouse() inside of a tool to actually be able to perform that event? I feel like there might be an event for tools to use keys. Just a question, thanks!
Report Abuse
Garfanzo is online. Garfanzo
Joined: 24 Apr 2015
Total Posts: 742
18 Jan 2016 04:54 PM
:GetMouse() can be used in both local and server scripts, the one thing is that if this is in workspace it should be a server script, unless you turn FE off, but I would stick with a server script.
Report Abuse
GliconCraft is not online. GliconCraft
Joined: 17 Dec 2015
Total Posts: 99
18 Jan 2016 04:57 PM
Oh, I guess that I assumed it was limited to local scripts because I used game.Players.LocalPlayer:GetMouse(), right? So instead, perhaps something like:


local mouse

script.Parent.Equipped:connect(function()
mouse = game.Players:FindFirstChild(script.Parent.Parent.Name):GetMouse()
mouse.KeyDown:connect(function(key)
if key == "q" then
--script
end
end)
end)
Report Abuse
GliconCraft is not online. GliconCraft
Joined: 17 Dec 2015
Total Posts: 99
18 Jan 2016 05:01 PM
Oh, do I have to disconnect the event inside the unequipped event too? Woops.
Report Abuse
Garfanzo is online. Garfanzo
Joined: 24 Apr 2015
Total Posts: 742
18 Jan 2016 05:06 PM
Something like that should work, lol.
Report Abuse
IllegallyBlind is not online. IllegallyBlind
Joined: 07 Nov 2010
Total Posts: 1691
18 Jan 2016 05:06 PM
both of you deserve to be burned.


jk just use user input service ok


i make u math.sqrt()
Report Abuse
Garfanzo is online. Garfanzo
Joined: 24 Apr 2015
Total Posts: 742
18 Jan 2016 05:13 PM
I have looked into UserImputService, but I cannot figure out how to use it... I'll post a forum about this.
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