I am trying to use a modular script but I need it to take a parameter when called.
require(game.Workspace.ModScript,"THIS PARAMETER") or require(game.Workspace.ModScript)("THIS PARAMETER")
If this is possible how would I call it on the modular script?
local function createMessage (message, time) local debris = game:GetService('Debris') local screen = Instance.new('Message') screen.Text = tostring(message) screen.Parent = workspace debris:AddItem(screen, time) end return createMessage;
If the module only returns a function, you can call it along with your require like so require(id)(arguments)
require(workspace['path'])('Scripting Helpers', 5) --[[ would create a message in the workspace with the text `ScriptingHelpers`, and will only display for five seconds as indicated by the arguments. ]]
source: this