--// Script
local MyLibrary = require(game.ServerScriptService.ModuleScript)
MyLibrary.CreateObject("Sparkles", game.Workspace.SpawnLocation, Color3.new(85, 255, 0))
--// ModuleScript
local MyLibrary = {}
MyLibrary.Output = function(str)
print(str)
end
MyLibrary.CreateObject = function(type, parent, sparklecolor)
Instance.new(type, parent, sparklecolor)
end
return MyLibrary
✓ ANSWER ACCEPTED
Why doesnt this work?
1 answer
✓ Accepted answer
Try using it
--// Script
local MyLibrary = require(game.ServerScriptService.ModuleScript)
MyLibrary.CreateObject("Sparkles", game.Workspace.SpawnLocation, Color3.new(85/255, 255/255, 0/255))
--// ModuleScript
local MyLibrary = {}
MyLibrary.Output = function(str)
print(str)
end
MyLibrary.CreateObject = function(type, parent, color)
local int = Instance.new(type, parent)
if color ~= nil then
int.SparkleColor = color
end
end
return MyLibrary
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
SparkleColor is not a valid argument of Instance.new(). You need to make a new line to set the SparkleColor.
Like how?
You would make a new line in the CreateObject function to change the sparklecolor...
Please make your question title relevant to your question content. It should be a one-sentence summary in question form.