Hello, I am trying to add nitro button to my car but i can't get the players mouse for some reason this is what I have right now:

local character = script.Parent.DriveSeat.Occupant
local player = game.Players:GetPlayerFromCharacter(character.Parent)
local mouse = player:GetMouse()

script.Parent.DriveSeat.Changed:Connect(function(prop)
	if prop == ("Occupant") then
		character = script.Parent.DriveSeat.Occupant
		player = game.Players:GetPlayerFromCharacter(character.Parent)
		mouse = player:GetMouse()		
	end
end)

if mouse then
	mouse.KeyDown:connect(function(key)
		if key:lower() == "r" or key:upper() == "R" then
			print("Pressed the nitro")
		end
	end)
end

1 comment

0

the humanoid has a sit property