Log in to vote

'Create' function usage?

Asked by
adark 5487 Badge of Merit Moderation Voter Community Moderator
8 years ago
local Create = assert(LoadLibrary("RbxUtility")).Create

local projectiles = {
    icebolt = {
        Name = "Icebolt",
        Parent = Workspace,
        BrickColor ="Bright blue"),
        Reflectance = .5,
        Transparency = .2,
        Anchored = true,
        FormFactor = Enum.FormFactor.Custom,
        Size =, .4, .4),

function fire(target, projectile)
    local proj = Create("Part")(projectiles[projectile])

    Fire = fire

I'm trying to use the Create function of the RbxUtility to create the parts for this projectile launcher ModuleScript, but this doesn't appear to be working.

The fire function here is called once:

local proj = require(script.Parent.ProjectileScript)
proj:Fire(nil, "icebolt")

But the icebolt isn't being created from the 'icebolt' table in the ModuleScript, it is only creating a new Part with no properties changed from default.

Wow, your question is really thorough ._. Legojoker 345 — 8y
This is above my head. Congrats on being able to understand it. Perci1 4988 — 8y
I can understand it a little with the help of the wiki link he gave xD but yeah unfortunately I doubt I'll be able to help either D: Legojoker 345 — 8y
OH! maybe if you made icebolt a string value in the table it would work? Like ["icebolt"] = {properties for the icebolt} I think that should fix it. Legojoker 345 — 8y
View all comments (3 more)
Hmm , I think I know the problem. HexC3D 830 — 8y
Please share, Hex. @Lego; the way I wrote it is just syntactic sugar for the way you wrote it. They are interpretted into the exact same bytecode. adark 5487 — 8y
Oh, sorry then, I never knew that! Well thanks for the lesson xD Legojoker 345 — 8y

Answer this question