This script is supposed to make a region3 and a part that represents the area. The part at line 5 does not make a part for some reason. Can someone test and find out why it doesn't work? I can't seem to figure out the problem.
local pos1 = game.Workspace.Pos1.Position
local pos2 = game.Workspace.Pos2.Position
local region = Region3.new(pos1, pos2)
for count = 1, 1, 1 do
local part = Instance.new("Part", game.Workspace)
part.Anchored = true
part.Size = region.Size
part.CFrame = region.CFrame
part.BrickColor = BrickColor.new("Really red")
part.Transparency = 0.95
part.CastShadow = false
part.CanCollide = false
end
while true do
wait(1)
local partsInRegion = workspace:FindPartsInRegion3(region, pos1, pos2, 100)
local playersFound = {} --Table of players found
for i, part in pairs (partsInRegion) do
if part.Parent:FindFirstChild("Humanoid") ~= nil then
print(part.Parent.Name)
playersFound[part.Parent.Name] = part.Parent
end
end
for plrName, char in pairs (playersFound) do
spawn(function()
local fire = Instance.new("Fire", char.HumanoidRootPart)
fire.Size = 20
wait(2)
char.Humanoid:TakeDamage(50)
wait(2)
char.Humanoid:TakeDamage(50)
end)
end
end

1 comment
But is it possible to use 2 parts to mark both corners? and if so how?