You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I want to make a system where I can pass an object and have it run a function based upon the value passed/ -
What is the issue? Include screenshots / videos if possible!
Error is “Passed value is not a function”
Main Script,
local module = require(script.ModuleScript)
local items = game.Workspace:WaitForChild('ScriptableObjects')
local DisappearObjects = items.DisappearObjects:GetChildren()
module.objConnection(DisappearObjects, module.Disappear)
Module Script,
local module = {}
function module.Disappear(obj)
obj.CanCollide = false
wait(3)
obj.CanCollide = true
end
function module.objConnection(obj, fun)
for i,v in pairs(obj) do
v.Touched:Connect(fun(v))
end
end
return module