What is the ideal way of having contact damage?

I have a big enemy. I want it so, while the player is touching said enemy, he is dealt damage. What is the most optimal way of implementing this?

1 Like

Look into the .Touched event.

local boxPosition = CFrame.new(0,0,0)

local boxSize = Vector3.new(10,10,10)

local OverlapParams= OverlapParams.new()

OverlapParams.FilterType = Enum.RaycastFilterType.Blacklist

OverlapParams.MaxParts = 10

OverlapParams.FilterDescendantsInstances = { otherPart }

local objectsInSpace = workspace:GetPartBoundsInBox(boxPosition,boxSize,OverlapParams)
1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.