How can i make this work for Controller players?

Hello, How can I make it so when players life the right trigger it would play the turbo sound like what happens when you lift W on keyboard

here is the code:

wait(0.1)
local player = game.Players.LocalPlayer
local carSeat = script.Parent.CarSeat.Value
local mouse = game.Players.LocalPlayer:GetMouse()



 
mouse.KeyUp:connect(function (key)
    key = string.lower(key)
    if key == "w" then
		carSeat.BoV:Play()
		
		
end
end)

*I did not make this code so I do not take credit *

JoystickController up or GamepadController up, although you’ll need to use UserInputService for that.

I think your first problem here is that this is copied, making this whole script nearly useless

For this issue you’ll need to use and implement UserInputService which should be the most efficient way of doing so. With this you can use functions such as: “InputStarted” & “InputEnded” to help give your script more stability. The API Refrence should help a ton :grinning_face_with_smiling_eyes:

1 Like