As of recently I’ve been experimenting with Maids and Signals and how I could use them to my advantage in my projects.
Here I have a Player class where it handles its leaderstats, balance and what not.
My problem here is that unable to give the Maid the Connection for what reason and I’m very confused.
Any fixes?
Here’s the error:
And here’s the code:
function Player.new(player: Player)
local self = setmetatable({}, Player)
self._maid = Maid.new()
self.Balance = 0
self.MoneyChangedSignal = Signal.new()
self._maid:GiveTask(self.MoneyChangedSignal:Connect(function(newVal)
print(("%s's new balance is %s"):format(player.Name, newVal))
end))
PlayerInit(player, self.Balance)
return self
end
function Player:Destroy()
self._maid:DoCleaning()
end
