Hi,
I have an issue where custom instance methods are not working.
I have the following code:
-- function NOT used for granting a plr new staff member, but instead used for instantiating a StaffMember object
-- using predefined staff member data that the appropriate class methods can be used on
function StaffMember.new(staffMemberUUID: string, staffMemberData: {}): StaffMemberInstance
local staffMember = {}
setmetatable(staffMember, StaffMember)
... -- properties omitted for brevity
return staffMember
end
After creating an instance, here is one of the methods that be called on it
function StaffMember:GetSkillLvlMultiplier()
return StaffMember.Constants.SkillLevelMultipliers[tostring(self.Rarity)]
end
Here is one example of me creating a new instance and calling a method:
for staffMemberUUID: string, staffMemberData in profile.Data.Inventory.StaffMembers do
if table.find(staffMembersToIgnore, staffMemberUUID) then continue end
local staffInstance = StaffMemberConfig.new(staffMemberUUID, staffMemberData)
print(staffInstance)
staffInstance:AdjustEnergy(plr, staffMemberUUID)
end
My issue is though, that when trying to call these methods, they seem to not exist
And this gets printed to the console (note only properties are shown, no methods, which is my problem)
What I find odd though is that the other day they worked perfectly fine, and I don’t think I’ve made any breaking changes to the staff member code, let alone any changes at all. I’ve tried asking chatgpt for help but it can’t find my issue with the code I provided (similar to what I provided above), so I’m wondering if it’s an underlying issue elsewhere in my code. I figured I’d ask here first though.
Any help would be appreciated!