---
title: "getpubvar | open.mp"
description: "Gets a specific public variable from the current script."
canonical: https://omp.itsneufox.com/docs/scripting/functions/getpubvar
language: en
---

# getpubvar

## Description

Gets a specific public variable from the current script.

| Name | Description |
| --- | --- |
| const name\[\] | The public variable's name. |

## Returns

Naught if the variable doesn't exist (use [existpubvar](https://omp.itsneufox.com/docs/scripting/functions/existpubvar) first).

## Related Functions

-   [setpubvar](https://omp.itsneufox.com/docs/scripting/functions/setpubvar): Sets a specific public variable in the current script.
-   [existpubvar](https://omp.itsneufox.com/docs/scripting/functions/existpubvar): Checks if a specific public variable exists in the current script.
-   [numpubvars](https://omp.itsneufox.com/docs/scripting/functions/numpubvars): Counts how many public variables there are in the script.
