Requiring modules?

How do I run a function on a module by using just require(module)?
I have seen this done before but I am not sure how to do it.

Server script:

require(game.ReplicatedStorage.MainModule)

Module:

return function()
	local Hint = Instance.new("Hint", workspace)
	Hint.Text = "Working!"
end

Nothing happens? How do I make this work without changing the server script?

Thanks!

Your module is returning a function so if you want it to execute it just call it :slight_smile:

require(game.ReplicatedStorage.MainModule)()

Hints are depreciated btw.

How can I make my module run code without changing what is inside the server script?

Could you elaborate more I don’t understand.

If you want the code to run when you require it just put it inside of the body:

local Hint = Instance.new("Hint", workspace)
Hint.Text = "Working!"

return 

Although this defeats the purpose of modules.