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: If person in vehicle seat presses "e"

Previous Thread :: Next Thread 
Im_King is not online. Im_King
Joined: 14 May 2010
Total Posts: 2352
23 Apr 2016 05:42 PM
Then do -


How would you do that?


The script wouldn't be in the vehicle seat but in the same model


Add 25K posts
Report Abuse
joji1000 is not online. joji1000
Joined: 23 Aug 2013
Total Posts: 291
23 Apr 2016 05:48 PM
get the player from the vehicle seat under the property of 'Occupant'
a way to do this would be to use
Player = game.Players:FindFirstChild(script.Parent.Seat.Occupant)
then you can detect if the player pressed a button
Player:GetMouse().KeyDown:connect(function(Key)
if Key == 'e' then
--put what ever action you want
end
end)
Report Abuse
Im_King is not online. Im_King
Joined: 14 May 2010
Total Posts: 2352
23 Apr 2016 05:58 PM
That didnt work

Player = game.Players:FindFirstChild(script.Parent.Seat.Occupant)
Player:GetMouse().KeyDown:connect(function(Key)
if Key == 'e' then
script.Parent.RR.Motor.DesiredAngle = 0.3
script.Parent.RR.Motor.MaxVelocity = 0.005
end
end)


Add 25K posts
Report Abuse
Im_King is not online. Im_King
Joined: 14 May 2010
Total Posts: 2352
23 Apr 2016 06:07 PM
b


Add 25K posts
Report Abuse
Im_King is not online. Im_King
Joined: 14 May 2010
Total Posts: 2352
23 Apr 2016 06:41 PM
bb


Add 25K posts
Report Abuse
unroot is not online. unroot
Joined: 18 Sep 2009
Total Posts: 1114
23 Apr 2016 07:02 PM
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:connect(function(Input, GPE)
if Input.UserInputType == Enum.UserInputType.Keyboard then
if Input.KeyCode == Enum.KeyCode.E then
print("e was pressed")
end
end
end)


#code print("yolo" .. string.rep("o", math.huge))
Report Abuse
Alimegacorn is not online. Alimegacorn
Joined: 24 May 2013
Total Posts: 899
23 Apr 2016 07:04 PM
do the occupant thing

BUT

for the keydown do this

Mouse = game.Players.LocalPlayer

--Occupant thing
function onKeyDown(key)
key = key:lower() -- you need dis peeps
if key == "e" then
-blah blah blah
end

Mouse.KeyDown:connect(key)
Report Abuse
unroot is not online. unroot
Joined: 18 Sep 2009
Total Posts: 1114
23 Apr 2016 07:07 PM
KeyDown is deprecated, use UserInputService or ContextActionService.


#code print("yolo" .. string.rep("o", math.huge))
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