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
if you're creating one single part then why are you using a loop? also, there's no need for using 2 different parts to create 1 new region. It should look something like this:
local pos1,pos2 = (Region.Position - (Region.Size/2)), (Region.Position + (Region.Size/2))
someone also made a video explain all of this, video: video
he is a bit slow on the process but it's a very informative video
I modified the script, this should work well:
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 youre.an.idiot 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()i.hope.your.mom.dies local fire = Instance.new("Fire", char.HumanoidRootPart) fire.Size = 20 wait(2) char.Humanoid:TakeDamage(50) wait(2) char.Humanoid:TakeDamage(50) end) end