I have this script in a vehicleSeat and i want it to find my player when i sit and be able to use Q, E and the mouse button.
right now i get the error : MouseButton1Down is not a valid member of PlayerMouse at line 30 but i think there are other things not working.
local sit = false
function onTouched(hit)
if hit.Parent.Humanoid ~= nil then
if sit == false then
sit = true
local plr = hit.Parent.Name
local player = game.Players:FindFirstChild(plr)
local mouse = player:GetMouse()
local s = script.Parent.TurnSpeed/140
-- Q and E
mouse.KeyDown:connect(function(key)
--key = key:lower()
if key == "q" then
script.Parent.BodyGyro.cframe = script.Parent.CFrame*CFrame.fromEulerAnglesXYZ(0, s, 0)
end
if key == "e" then
script.Parent.BodyGyro.cframe = script.Parent.CFrame*CFrame.fromEulerAnglesXYZ(0, -s, 0)
end
end)
-- Mouse
mouse.MouseButton1Down:connect(function(key)
print 'firing'
end)
sit = false
end
end
end
script.Parent.Touched:connect(onTouched)

1 comment
Thank you but the parts where i want to press Q and E dont work and i dont get any errors can you help me on this?