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: How would I (KeyDown event)

Previous Thread :: Next Thread 
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
24 Dec 2012 12:44 PM
How would I acces the mouse through a seat that a character is sitting in?

Lets assume I already have the player, what would I do?
Report Abuse
miniTeam is not online. miniTeam
Joined: 28 Oct 2012
Total Posts: 27
24 Dec 2012 12:46 PM
Many things, but you won't do them.
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
24 Dec 2012 12:49 PM
I will do them, now tell me please.
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
24 Dec 2012 12:55 PM
mouse = player:GetMouse()
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
24 Dec 2012 01:10 PM
mouse = player:GetMouse()

mouse.KeyDown:connect(function(k)
key = string.lower(k)
if key == "r" then
player.Character.Humanoid:TakeDamage(player.Character.Humanoid.MaxHealth)
end
end)

-- Reset Key :P
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
24 Dec 2012 02:02 PM
mouse.KeyDown:connect(function(key)
key = key:lower()
if key == "r" then
--do stuff here
elseif key == "g" then
--do more stuff here, if you only want one key, then delete this line and the elseif line
end end)
Report Abuse
jelly134 is not online. jelly134
Joined: 25 Aug 2008
Total Posts: 1137
24 Dec 2012 02:03 PM
use the variable definition from the post above my last.
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
24 Dec 2012 02:07 PM
:3

He said a seat he is sitting on..

put this in seat..

script.Parent.Touched:connect(function (hit)
if hit.Parent:findFirstChild("Humanoid") then
x = game.Players:GetPlayerFromCharacter(hit.Parent)
mouse = x:GetMouse()
mouse.KeyDown:connect(function (key)
if key:lower() == "r" then
x:LoadCharacter()
end
end)
end)

script.Parent.TouchEnded:connect(function ()
break
end)
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