Help with module function inheritance

hey! i tried to make some ability system with a new system i nicknamed Addons, which allow me to specify alternative modules that inherit a base class and changes how it runs / activate abilities, here’s how they are built

loader

local selectedHandler = v.Addon and require(v.Addon) or UIcreator
			if v.Addon then
				warn("addon found!")
			end
			local frame = selectedHandler.new(plr, surface, v)

addon

local base = require(game.ServerScriptService["Class Selector"].AbilityHandler["Ability UI button"])
local addon = {}
addon.__index = addon

setmetatable(addon, base)

function addon:loadAditionalSelfValues()
	warn("sup! this is a new addon! cool, right?")
	warn("Addon Name: " .. self.Name)
end

warn("loaded new addon: " .. script.Name)

return addon

base ability (the part that activates the loadAdditionalSelfValues

function module.new( 
	plr:Player,
	Surface:SurfaceGui,
	Ability:{
		
		Name:string,
		SizeScale:number?,
		Cooldown:number,
		Cost:number?,
		HealthThreshold:number,
		KeybindMapping:{Enum.UserInputState},
		Events:{RemoteEvent | RemoteFunction | BindableEvent | BindableFunction}
		
	})
	
	local self = {}
	setmetatable(self, module)
	
	local Visible = Ability.Visible == nil and true or Ability.Visible
	
	local inputEvent:RemoteEvent = plr.PlayerGui:FindFirstChild("inputEvent") 
	if not inputEvent then
		inputEvent = Instance.new("RemoteEvent")
		inputEvent.Name = "inputEvent"
		inputEvent.Parent = plr.PlayerGui
	end

	local char = plr.Character or plr.CharacterAdded:Wait()
	local human = char:FindFirstChildOfClass("Humanoid")

	self.Enabled = true
	self.Cooldown = Ability.Cooldown
	self.Cost = Ability.Cost or 0
	self.HealthThreshold = Ability.HealthThreshold or math.huge
	self.Events = Ability.Events
	self.Mapping = Ability.KeybindMapping
	self.sizeScale = Ability.SizeScale or 1

	self.cooldownRemaining = 0
	self.CooldownSpeedBoost = 1
	
	self:loadAditionalSelfValues() -- loads added-in 'self.' values among other things

this is the log
image
as you can see, the addon dont seem to be making at difference! what is happening?

1 Like

ah, i think i figured it out
the base system is calling the functions from the base system rather than the addon’s inherited functions, so they aren’t really modifying anything, well, thats a bummer
i’m planning some new things to see if i can fix it, maybe using proxy patterns

1 Like