This is the local script:
local P = Events.GeneralFunction:InvokeServer("ButtonP", Cloak)
Which travels to the EventHandler script in ServerScriptService
Events.GeneralFunction.OnServerInvoke = function(Plr, Request, Data) if Request == "ButtonP" then local Power = powerData[plrData["Buttons"][Data]] return Power end end
"powerData" is a module script which holds the super power data such as cooldown, but I would like to also store the function that the power does:
local module = { ["Cloak"] = { ["CoolDown"] = 5; ["Activated"] = function(Plr) print(Plr) end } }
However, if i were to below in a local script:
P["Activated"](Plr)
it doesn't seem to work or print the player as set by the function, is what I'm doing actually possible?
In order to call the function, you'd do
local module = require(module)
module["Cloak"]:["Activated"](Plr)