Is their a way to make functions with module scripts?

Im trying to make custom functions with a module script, how am I supposed to do this?

local module = {}

function module:DoThing()
	--Code
end

return module
1 Like

and how would I connect that to a regular script?

local replicatedStorage = game:GetService('ReplicatedStorage')
local module = require(replicatedStorage:WaitForChild('ModuleScript'))
module:DoThing()
1 Like

Thanks for the help! Where should I put module scripts?

ReplicatedStorage is usually the best place unless you know that you’ll be using the module exclusively server-side.