How to damage players inside of a part once

I’m simply just trying to make an explosion damage affect. I already have a part that spawns in. I just need it to detect how many players are within the part and then damage them for a quick/split instant.

Help is appreciated, thanks!

1 Like

This should work

server script under the part directly

task.wait(5)

local touching = workspace:GetPartsInPart(game.Workspace.Test)

local damagedHums = {}

for i, v in pairs(touching) do
	
	if v.Parent:FindFirstChild("Humanoid") and not damagedHums[v.Parent.Humanoid] then
		
		v.Parent.Humanoid:TakeDamage(50)
		damagedHums[v.Parent.Humanoid] = true
	else
		
	end
end
1 Like

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