# dxDrawLine (Client)

> Draws a 2D line on the screen for one frame.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Client
- **Category**: Screen drawing
- **URL**: https://wiki.mymp.gg/en/dxDrawLine

## Syntax

```lua
bool dxDrawLine(float startX, startY, float endX, endY [, color color = tocolor(255, 255, 255), float width = 1, bool postGUI = false])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `startX, startY` | `float` | Start point, in pixels. A vec2 also works. |
| `endX, endY` | `float` | End point, in pixels. A vec2 also works. |
| `color` | `color` | Colour, a `tocolor` value. *(default: `tocolor(255, 255, 255)`)* |
| `width` | `float` | Thickness in pixels. *(default: `1`)* |
| `postGUI` | `bool` | Draw on top of the interface. *(default: `false`)* |

## Returns

`true` once the drawing is queued.

## Example

```lua
local sx, sy = getScreenSize()

addEventHandler("onClientRender", root, function()
    dxDrawLine(sx / 2 - 10, sy / 2, sx / 2 + 10, sy / 2, tocolor(255, 255, 255), 2)
    dxDrawLine(sx / 2, sy / 2 - 10, sx / 2, sy / 2 + 10, tocolor(255, 255, 255), 2)
end)
```

## See also

- [dxDrawLine3D (Client)](https://wiki.mymp.gg/en/dxDrawLine3D.md): Draws a line in the 3D world for one frame. The line faces the camera.
- [dxDrawRectangle (Client)](https://wiki.mymp.gg/en/dxDrawRectangle.md): Draws a filled rectangle on the screen for one frame.
- [tocolor (Shared)](https://wiki.mymp.gg/en/tocolor.md): Packs a colour's components into a single ARGB number. It is the same function as rgb.
- [onClientRender (Client)](https://wiki.mymp.gg/en/onClientRender.md): Fired every frame, when that frame's dx drawing should be done.
