1

# 'Create' function usage?

8 years ago
local Create = assert(LoadLibrary("RbxUtility")).Create

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

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

return{
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.

1
Wow, your question is really thorough ._. Legojoker 345 — 8y
1
This is above my head. Congrats on being able to understand it. Perci1 4988 — 8y
1
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
1
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