I’m trying to use object oriented programming for my game, but I ran into an issue.
local module1 = {}
local module2 = require(game.ServerScriptService.module2)
Module1.Health = 50 -- example
Module1.Money = 100
function module1:AddTimeBomb(time)
module2:CreateTimeBomb(time)
end
return module1
--module 2
local module2 = {}
module2.__index = module2
module2:BlowUp()
---how would I make it do damage to the place it was called?
end
module2:CreateTimeBomb(time)
local bomb = {}
setmetatable(bomb,module2)
--id use run service but for the sake of simplicity I'll just
-- use a wait
wait(time)
bomb:BlowUp()
return bomb
end
return module2
I know my example is a bit lacking, but the question is how would I make the script required change information in the script requiring it?