> ## Documentation Index
> Fetch the complete documentation index at: https://docsuncv2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# getnamecallmethod

Returns the name of the method being called: for `player:Kick()`, that is `"Kick"`. <br /> Only `__namecall` produces this; no other metamethod does.

```luau theme={null}
getnamecallmethod(): string?
```

Most commonly paired with `hookmetamethod` to read the method name and decide whether to block, log, or redirect that specific call.

## Returns

`string?` - the method name as a string when called from inside a `__namecall` metamethod, otherwise `nil`.

## Example

Pick any Roblox game, where a LocalScript (or a ModuleScript) triggers a `:Kick()` on the `LocalPlayer` - detect the `Kick` namecall, and silence it before it executes.

<CodeGroup>
  ```luau Example 1 theme={null}
  <<<<<<< HEAD
  local method = getnamecallmethod()
  =======
  -- getnamecallmethod(): string?
  >>>>>>> 50e30f53759b0538759af25c9b271514aa2c9290
  ```

  ```luau Example 2 theme={null}
  local player = game:GetService("Players").LocalPlayer
  local mt = getrawmetatable(game)
  setreadonly(mt, false)

  local oldNamecall
  oldNamecall = hookmetamethod(game, "__namecall", function(self, ...)
      if getnamecallmethod() == "Kick" and self == player then
          warn(`Client tried to kick!`)
          return
      end
      
      return oldNamecall(self, ...)
  end)

  -- Note: this will not work if the server tries to kick you.
  -- Only applies to a client-sided :Kick().
  ```
</CodeGroup>

<Tip>
  Only valid when called inside a custom `__namecall` metamethod callback.
</Tip>
