You need to detect the InputBegan and InputEnded events on the client. If InputBegan then fire a remote to the server with MousePos. A InputEnded, stop firing remote. On server side, fire projectile/ray./whatever towards MousePos.
Quick dirty code: localscript:
UserInputService.InputBegan:Connect(function (input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and Mouse ~= nil then
IsMouseDown = true
end
end)
UserInputService.InputEnded:Connect(function (input)
if input.UserInputType == Enum.UserInputType.MouseButton1 and Mouse ~= nil then
IsMouseDown = false
end
end)
game:GetService("RunService").Stepped:Connect(function ()
if IsMouseDown then
MouseEvent:FireServer(Mouse.Hit.Position) -- A RemoteEvent to send MousePos to server
end
end)
server script
MouseEvent.OnServerEvent:Connect(function (clientThatFired, mousePoint)
-- fire bullets towards MousePos
end)
Nows it telling me that Workspace.Frostilism.InputGateway.Server:24: Argument #1 should be a boolean describing the activation state of the tool.
activation.OnServerEvent:Connect(function (clientThatFired, mousePoint)
local humanoid = char:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local tool = char:FindFirstChildWhichIsA("Tool")
if tool then
local player = game.Players:GetPlayerFromCharacter(char)
assert(clientThatFired == player, INVALID_SENDING_PLAYER)
assert(typeof(down) == "boolean", BAD_ARG_NUM1)
assert(typeof(mousePoint) == "CFrame", BAD_ARG_NUM2)
humanoid.TargetPoint = mousePoint.Position
tool:Activate()
end
end
end)
OK, so it is either not sending MousePos via the RemoteEvent, or the server when it fires is not using the MousePos as it’s target point. Just try printing the values at each step and see where it changes