Firstly, a new API update from ROBLOX allows you to easily check if the player is sitting in a seat with a new property in the Humanoid: SeatPart.
As for your problem, try using the InputChanged event. You can then use the KeyCode property as the event returns an InputObject
script.Parent:WaitForChild("Humanoid").Changed:connect(function()
if script.Parent.Humanoid.SeatPart ~= nil then
game:GetService("UserInputService").InputChanged:connect(function(input)
if input.KeyCode == Enum.KeyCode.A then
print("Key has been pressed")
end
end
end
end)
KeyCode Enum.
You can also use the Seated event of the Humanoid (again, newly added) to check if the player is seated.
script.Parent:WaitForChild("Humanoid").Seated:connect(function(seated)
if not seated then return end
game:GetService("UserInputService").InputChanged:connect(function(input)
if input.KeyCode == Enum.KeyCode.A then
print("Key has been pressed")
end
end
end)
I hope this answer helped you. If it did, be sure to accept it.