So I am busy with oop and I have this error:
15:13:21.320 - ServerScriptService.Script:5: attempt to call a number value
Here is the script:
local Family = {}
Family.__index = Family
Family.Died = Instance.new("BindableEvent")
function Family.new(Name)
local Human = {}
Human.Name = Name
Human.Age = 0
Human.Gender = math.random(1,2)
setmetatable(Human, Family)
return Human
end
function Family:Age()
print("E")--for testing obviously
end
return Family
Normal script:
local Family = require(game.ServerStorage:WaitForChild("Family"))
local Child = Family.new("Tristan")
Child:Age()--error happens here.
For some reason when I use :Age() it doesn’t work but when I use something else it works.