Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I reference something in a module script?

Asked by 4 years ago
Edited 4 years ago

I am trying to perform a data save on a clone in a folder(The clone gets created when you buy the thing in the shop) Does anyone know how to Save(or data save this object)And one more thing is that I m already saving a module script of properties(This is tat module script)That apply to said model.

local module = {}

module.FluffInventory = { BodyType = (""), BodyColor = (""), FluffDescription = (""),
FluffInfo = { FluffName = (""), FluffGender = ("") }
}

return module

1 answer

Log in to vote
0
Answered by
blazar04 281 Moderation Voter
4 years ago
Edited 4 years ago

You need to use local module = require(moduleScript)

Then you can access a variable like so: module.FluffInventory

Those other variables called Fluff1, Fluff2, etc cannot be accessed outside of the module script because you need to define the variable as module.Fluff1 = ... not Fluff1 = ....

0
For the first bit I used a variable in the outside script for the require thing which I would have bee more clear of and for the second part about not being able to access them I have the Fluff one underneath another variable within that so what should I do ExecutiveJoe 5 — 4y
0
It seems that you haven't embedded your whole script on your post, so it is really hard to read. Can you make sure that the all of the code on your post is under the squiggly lines (~~~~~~~~~~~)? blazar04 281 — 4y
0
Also, one thing that I naively left out is the use of classes in this case. Notice how every time you create a "Fluff" you have to redefine all of those properties such as BodyType, BodyColor, etc? What you can do instead is make fluff an object that you can create new instances of. I STRONGLY suggest you read this post: https://devforum.roblox.com/t/all-about-object-oriented-programming/8585 blazar04 281 — 4y
Ad

Answer this question