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.

7 comments

1

Wow, your question is really thorough ._.

1

This is above my head. Congrats on being able to understand it.

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:

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.

1

Hmm , I think I know the problem.

0

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.

1

Oh, sorry then, I never knew that! Well thanks for the lesson xD