How to see what client executed a function on a module?

So there is RunService:IsClient(), which returns true if a module is running on the client, and false on the server.
But is there a way to see what client is executing a function on the module?
For example, I’m working on a welding module, but I want clients that run it banned.

So is there a way to get the client?

1 Like

I don’t understand the question, but RunService:IsClient() is true whenever the module is required from a local script, so the client running the module would be the LocalPlayer (game.Players.LocalPlayer).

1 Like

Basically the question is, if RunService:IsClient() returns true, how do I get the client that required the module?

1 Like

I don’t think you quite understand the client-server model roblox uses or how module scripts work , the player is the LocalPlayer, the only way you can tell when a client is running a function from a module is by firing a remote event to the server. When you require a module it just returns whatever you tell it to (A function or table), the RunService:IsClient() method only lets you know from the module script that it is being executed in a local script. This method is useful if you want the module to execute code based on the environment it is in, the server does not track who is currently using a module script.

I would use a function like this:

if game:GetService("RunService"):IsClient() then
     local Player = game.Players.LocalPlayer
     -- Run code to ban player here (I would recommend using a remote event)