Help With Module Scripts

Hi So I’ve Made A Module Script
For Example

local PrintModule = {}

function PrintModule:printMessage(message)
	print(message)
end

return PrintModule

as you can see the function is
PrintModule**:**printMessage(message)

So It Works But

sorry its kinda blue cuz I cant take the screenshot the normal way
but you get the idea

when we type module.
it shows the option for module:

which bugs the function is there any way to fix it?

What is it you are trying to do?
PrintModule is now the ‘required’ module, not a reference to the script in the explorer.
As there are no other functions or tables inside the module it provides just the one option.
If you want to access properties of the moduleScript itself you will need to create a reference to the object

local module = game:GetService("ServerScriptService").module
module.child --forexample

no I want to make it look better using colon ( : ) instead of “.”
but it shows the option for which doesnt exist as u saw in the image
the module script have a function using (: colon) not “.” but its showing an option for “.” which will confuse people and it also make the function not work

It isn’t recommended to use : instead of . if you’re not using metatables. : passes the self argument, which isn’t applicable in your use case here.

understandable thanks for the help

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.