Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to access function from module?

If I have a module script:

function charSettings:buildStandard(player, folder, data)

in order to get that value from a script I'd do,

charSetup:buildStandard(player, player.tempData, player.data)

right? because im getting the error: attempt to call a nil value. Does this mean the function is nil? print(charSettings) works it returns a table so Im not sure why this is happening.

1 answer

✓ Accepted answer

In your module:

local Module = {}

-- function here

-- example:
Module.YES = function()

	print("YES")

end)

return Module

How to get it from a other script (if the module is named ModuleScript and is parented to game.Workspace):

local Module = require(workspace.ModuleScript) -- get module
Module.Yes() -- does the function (works with areguements)

3 comments

1

Thank you!

0

np

0

np

This discussion is preserved as it was. New answers, comments, and votes are closed.