I wanted to make a button that kills everyone in a certain area when someones press it.
The problem is that, no players are being killed.
I tried using Region3 but it doesn’t seems to work.
There is the script i’ve tried so far:
local Point1 = Vector3.new(-289.444, 95.512, -84.533)
local Point2 = Vector3.new(-955.267, -148.882, 627.907)
local Region = Region3.new(Point2,Point1)
function onClicked()
for _, part in pairs(game.Workspace:FindPartsInRegion3(Region,nil,math.huge)) do
local hum = part.Parent:FindFirstChild("Humanoid")
if not hum then continue end
hum.Health = 0
end
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)