#How do I convert a module script into normal script language.

20 messages · Page 1 of 1 (latest)

boreal coral
#

For example, a require script, how would I make it into a normal script in converting it.

lethal raptorBOT
#

studio** You are now Level 2! **studio

night crow
#

Just create a new script then copy the contents of the module script into it. Then don't return anything at the end of the script

boreal coral
#

So i'd just paste my module

#

into it

night crow
#

Though if you have a module script just require it from another script and use it.

boreal coral
#

im tryna make it

#

a localscript

#

converting a module

#

to local script

night crow
#

But why not just call the module from a localscript?

lethal raptorBOT
#

studio** You are now Level 1! **studio

boreal coral
#

i need it plain local script

night crow
#

the module script is returning something at the end, right?

boreal coral
#

or would i be able to use a roblox plugin

#

no

night crow
#

then it's not a module script. If it's just functionality you need from the script, copy it into a new script somewhere under 'StarterPlayer`

#

So a module script might look like this, say somewhere in replicated storage:

local Util = {}

function Util.PrintVector(inVec)
    return "(" .. inVec.X .. "," .. inVec.Y .. "," .. inVec.Z .. ")"
end

return Util
#

So if I want to use that from a client (localstorage) script, I'd go something like:

local RS = game:GetService("ReplicatedStorage")
local Util = require(RS:WaitForChild("Common"):FindFirstChild("util")) -- assuming script is under ReplicatedStorage and called 'util.rs'

local vec = Vector3.new()
Util.PrintVector(vec)