local function Fire(_, inputState)
if inputState ~= Enum.UserInputState.Begin then return end
print("Fired")
end
game:GetService("ContextActionService"):BindAction("GunFire", Fire, false, Enum.UserInputType.MouseButton1)
local localPlayer = game.Players.LocalPlayer
local mouse = localPlayer:GetMouse()
mouse.Button1Down:Connect(function()
print('clicked')
-- code here
end)
I’ve noticed recently using UserInputService to run the controls for my construction vehicles (arms, scoops, lifts etc.) that the controls won’t quit operating when you release the inputs.
This seems to be working with VehicleSeats as well, as in, you’ll be driving along, release the W key, and the vehicle keeps moving forward like you had W pressed down.
I haven’t been able to trace it to my scripts, or lag or anything else since I hadn’t changed anything in the scripts. The scripts also look for an InputChanged to start the function, not a while true loop.