I'm not sure why this isnt working! I did get this error tho,
22:33:31.904 - Requested module experienced an error while loading
Server Script:
local Make = require(script.MakeBrick) Make("AmazingPart", BrickColor.new('Lime green'), Enum.Material.Neon, game.Workspace)
Module Script:
function MakeBrick(Name, Color, Material, Parent) local Part = Instance.new('Part', Parent) Part.Name = Name Part.BrickColor = Color Part.Material = Material Part.Anchored = true Part.CFrame = game.Workspace.SpawnLocation.CFrame end return MakeBrick()
Read your output. It says that the "request module experienced an error while loading".
What is that error? It says
09:14:06.321 - ServerScriptService.Script.MakeBrick:3: bad argument #3 to 'Name' (string expected, got nil)
09:14:06.323 - Stack Begin
09:14:06.324 - Script 'ServerScriptService.Script.MakeBrick', Line 3 - global MakeBrick
09:14:06.324 - Script 'ServerScriptService.Script.MakeBrick', Line 10
09:14:06.324 - Stack End
Why is the modulescript calling MakeBrick
on line 10?
return MakeBrick()
That's clearly not right. MakeBrick
doesn't return anything, so this can't be correct.
You want the ModuleScript to give other people the function itself, so you can't call it for them.
The last line of the ModuleScript should be modified to be
return MakeBrick -- without parentheses!