So err, this time I’m trying to make a walking Crusher-like object.
Basically what i want is when the Crusher hits an humanoid It’ll instantly vanish that hit object.
Here’s the code that I have been struggling with.
The code works well at first but when there’s another instance it just stopped working, no error.
local overlapsParam = OverlapParams.new()
overlapsParam.FilterType = Enum.RaycastFilterType.Include
overlapsParam.FilterDescendantsInstances = {workspace.Unit:GetChildren()}
local rs = game:GetService("RunService")
rs.Heartbeat:Connect(function()
local snailMain = snail.Torso.Torso
local bounds = game.Workspace:GetPartBoundsInBox(snailMain.CFrame,Vector3.new(12,12,12),overlapsParam)
local hitList = {}
for i,Contents in pairs(bounds) do
local e_character = Contents.Parent
local e_Hum = e_character:FindFirstChild("Humanoid")
if e_Hum then
if not hitList[e_Hum] then
hitList[e_Hum] = true
e_Hum:TakeDamage(e_Hum.Health)
end
end
end
end)