Issue:
Explosion.Hit:Connect
uses (Instance, number)
instead of (BasePart, number)
(Take note of how BasePart.Touched
uses (BasePart)
.) Explosion.Hit will only fire for BaseParts so using Instance in the type checking is a bit confusing and also hides BasePart specific functions from the type checker.
See: Explosion | Roblox Creator Documentation
Expected Behavior:
Change the Instance
type checking to BasePart
. This will allow the type checker to know that BasePart functions exist on the Instance being passed so developers don’t get warnings for this.
Repro:
local Expl:Explosion = Instance.new'Explosion'
Expl.Hit:Connect(function(Part: BasePart, Distance:number): ()
print('Hit part: ' .. Part:GetFullName())
end)
Pictures: