module:
local function GetObjectCategory(Object)
local Categories = {}
Categories["3D Interfaces"] = {Name = "3D Interfaces", "ClickDetector","Decal","Dialog","DialogChoice","MaterialVaiant","ProximityPromt","SurfaceAppearance","Texture"}
Categories["Adornments"] = {Name = "Adornments", "ArcHandles","BoxHandleAdornment","ConeHandleAdornment","CylinderHandleAdornment","Handles","ImageHandleAdornment","LineHandleAdornment","PathfindingLink"}
for i, Category in pairs(Categories) do
if table.find(Category, Object.ClassName) then
return Category.Name
end
end
end
return GetObjectCategory()
script:
local getobjectcate = require(script.Parent.ModuleScript)
print(getobjectcate(game:GetService("TestService"):WaitForChild("ArcHandles")))
replace your module with this
module = {}
function module.GetObjectCategory(Object)
local Categories = {}
Categories["3D Interfaces"] = {Name = "3D Interfaces", "ClickDetector","Decal","Dialog","DialogChoice","MaterialVaiant","ProximityPromt","SurfaceAppearance","Texture"}
Categories["Adornments"] = {Name = "Adornments", "ArcHandles","BoxHandleAdornment","ConeHandleAdornment","CylinderHandleAdornment","Handles","ImageHandleAdornment","LineHandleAdornment","PathfindingLink"}
for i, Category in pairs(Categories) do
if table.find(Category, Object.ClassName) then
return Category.Name
end
end
end
return module
and replace your script with this
local getobjectcate = require(script.Parent.ModuleScript)
print(getobjectcate.GetObjectCategory(game:GetService("TestService"):WaitForChild("ArcHandles")))
The problem here is that you are returning the results of running the function. To return the function, you just need to remove the brackets on the last line so that the function is not called:
return GetObjectCategory
1 Like