How do i make it so this just points at the middle of the screen instead of the cursor?

i want this script to point in the middle of the screen instead of the cursor pos.


game:GetService("UserInputService").InputBegan:Connect(function(daddy)
if daddy.KeyCode == key then
    if debounce then return end 
    debounce = true 

    local mousePosition = mouse.Hit.p 
    local originPosition = origin.Position 

    laserFireEvent:FireServer(mousePosition, originPosition)

    wait(cooldown)
    debounce = false 
end
end)

Think you’re looking for lookvector of the player?

Can you explain it better? Didn’t understood.
If you mean change mouse position, you can’t. I think that doing a custom mouse UI you can.

Try this out, I made a raycast from the Camera’s CFrame (aka the center of your screen) forward, and fired the remote with the position that it hit.

game:GetService("UserInputService").InputBegan:Connect(function(daddy)
    if daddy.KeyCode == key the
        if debounce then return end 

        local camera = game.Workspace.CurrentCamera
        local cameraPosition = camera.CFrame.p
        local cameraLookVector = camera.CFrame.LookVector * 1000

        local raycastResult = game.Workspace:Raycast(cameraPosition, cameraLookVector, RaycastParams.new())

        if raycastResult and raycastResult.Position then
            debounce = true 
            local originPosition = origin.Position 

            laserFireEvent:FireServer(mousePosition, originPosition)

            wait(cooldown)
            debounce = false 
        end
    end
end)