How can I send a function to the client?

So I’m making a new script which is sort-of like those old star glitcher scripts and I was trying to find a way to the send the Idle function to the client. I’ve tried Remote functions, BindableFunctions etc. But they didn’t work. So is there any way that I can do this?

Why not just have the function accessible from the client in the first place?

Like either directly or through a module script.

The problem here is that you can’t directly send code over a remote event. You could send a string. You would need to interpret it on the client side.

How can I do that through a module script?

If a module script is accessible from both the server and client (like in ReplicatedStorage), both server and client scripts can run functions from it. They don’t share a state though so variables will still need to be passed back and forth

--Module side--
local module = {}

return module

function module.event(plr)
   print("module event appeared for "..plr.Name)
end

--Clientside--
local moduleScript = require(script.Parent)
local plr = game.Players.LocalPlayer


moduleScript.module.event(plr)

I believe this is how it works. You can try this. As I know it must fire it at client.

Is it possible to change a function in a module script?

Don’t quite know what you mean. You can make a table of different functions. Then you can pass a reference to them by name over a remote event.

I mean by changing a function while the script is running like this
IDLE
^ Well if that’s even possible