Hello, I am making a bomb. I want everyone inside that bomb to be affected however my previous method was to use .Touched
and it didn’t really work well for multiple entities but OverlapParams have came out since then and now I can finally have one bomb affect multiple entities
I can’t seem to really understand how this new feature works, currently I have an “Unable to cast value to Object” on line ExplosionOverlapParams.FilterDescendantsInstances = {damagetaker}
I tried looking at the raycast equivalent to this but It’s just so different and there isn’t a lot of documentation for this.
local PhysicsService = game:GetService("PhysicsService")
local ExplosionOriginal = game.ReplicatedStorage.Explosion:Clone()
damagetaker = "DamageTaker"
PhysicsService:RegisterCollisionGroup(damagetaker)
local ExplosionOverlapParams = OverlapParams.new()
ExplosionOverlapParams.FilterDescendantsInstances = {damagetaker}
ExplosionOverlapParams.FilterType = Enum.RaycastFilterType.Include
NewExplosion.Touched:Connect(function(hit)
--if touched then return end
if hit.CollisionGroup == damagetaker then
--touched = true
if hit.Parent.Health then
hit.Parent.Health.Value -= DamageCount
end
end
end)
local ExplosionHitbox = workspace:GetPartBoundsInBox(NewExplosion.CFrame, NewExplosion.Size, ExplosionOverlapParams)
print(ExplosionHitbox)
If I am missing details please tell me because sometimes my questions get closed for being vague, also I am not using humanoids here I am using punching bag-like models