Hello. I have programmed for a while using strict typing but something completely unexpected just happened. I have this Destroy method inside a class called Gun:
function Gun:Destroy()
self = nil
end
Very simple, just sets self to nil.
I call the Destroy method when I unequip my physical tool:
GunInstance.Unequipped:Connect(function()
GunObject:Destroy()
end)
Though, I get a warning from the type checker when calling the Destroy method.
From my point of view the content of this warning has nothing to do with the Destroy method because I never try to call a value of type number on the line I’m getting this warning.
Also, I know for a fact that the Gun object is being created correctly.
My doubt is, is this a mistake from the type checker? I literally have no idea how to solve it because the type checker warns something completely unrelated to my Destroy method.
(Keep in mind, I never reassign self to be a value of type number).