Rbx Lua Classes can't grab models?
The error is that the values assigned in the new method are nil to other methods of the class. How can I have the values not be nil when a method requests for them? As when I spawn a NPC and ask for the CFrame, it states self is nil.
04 | function NPC.new(model) |
05 | local entity = setmetatable ( { } , NPC) |
06 | for index, value in pairs (NPC) do |
10 | entity.Settings = model:WaitForChild( "Configurations" ) |
11 | entity [ "Mind" ] = model.Mind |
15 | function NPC:GetCFrame() |
16 | local humanoidRootPart = self.Self:FindFirstChild( "humanoidRootPart" ) |
17 | if humanoidRootPart and humanoidRootPart:IsA( "BasePart" ) then |
18 | print (humanoidRootPart.CFrame) |
19 | return humanoidRootPart.CFrame |
25 | function NPC:Initialize() |