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: Disconnect key down when jumped from seat?

Previous Thread :: Next Thread 
ilovecats969 is not online. ilovecats969
Joined: 23 Aug 2015
Total Posts: 173
15 Apr 2016 10:41 AM
Hello I have a script where it detects the player and gets the player mouse. There is then a function within that script so when the player presses a key there will be a function. However when you jump/leave the seat and press the key it still outputs the same function?

seat = script.Parent

seat.Touched:connect(function (hit)
if hit.Parent:findFirstChild("Humanoid") then
human = hit.Parent:findFirstChild("Humanoid")
wait(0.1)
if human.Sit == true then
player = true
else if human.Sit == false then
player = false
end
end
end
end)

script.Parent.ChildAdded:connect(function(child)
if child:IsA("Weld") and (child.Part1.Name == "HumanoidRootPart") then --// Detect player
local player1 = game.Players:GetPlayerFromCharacter(child.Part1.Parent)

local LocalPlayer = human.Name
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()

Mouse.KeyDown:connect(function(key)

if key == "q" then
print("I am pressing q")

end

end)
end
end)

How would I make it so this only works when the player is seated?
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
15 Apr 2016 12:02 PM
uis


Report Abuse
ilovecats969 is not online. ilovecats969
Joined: 23 Aug 2015
Total Posts: 173
15 Apr 2016 04:57 PM
Bump, Please anyone?

Thankyou!
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