|
| 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
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
| |
|
|
| 15 Apr 2016 04:57 PM |
Bump, Please anyone?
Thankyou! |
|
|
| Report Abuse |
|
|