Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Region3 Not Detecting Player?

Basically I can't find out why this Region3 will not work, it works in other positions however it won't work in a specific location that I want it in.


(I'm currently inside this region I made the script create a part the size of the region) I can't seem to find out why this isn't working I'm also not finding errors and it seems to work in the desert area completely fine. (As in replacing "Forest" with desert allows it to work inside the desert area.)

local desert = Region3.new(Vector3.new(255.5, 10.5, -256.5), Vector3.new(655.5, 107.5, 256.5))

local forest = Region3.new(Vector3.new(-256.5, 10.5, -256.5), Vector3.new(256.5, 107.5, 256.5))

  

local regionTest = Instance.new('Part', game.Workspace)

regionTest.Anchored = true

regionTest.Size = forest.Size

regionTest.CanCollide = false

regionTest.CFrame = forest.CFrame

regionTest.Transparency = 0.5

  

while wait() do

local partsInRegion = workspace:FindPartsInRegion3(forest)

for i, part in pairs (partsInRegion) do

if part.Parent:FindFirstChild("Humanoid") ~= nil and part.Parent:FindFirstChild("cRegion") ~= nil and part.Parent:FindFirstChild("cRegion").Value ~= "Forest" then

part.Parent.cRegion.Value = "Forest"

player = part.Parent.Name

print(part.Parent.Name)

end

end

end

Basically why isn't it printing the Players name and what are some possible solutions and why does it print in other locations? (Also I'm slightly new to using Region3)

1 answer

Remember that FindPartsInRegion3 takes three arguments, the region, an object to skip over(So if it detects the object in the region it will not include it in the table) and, what I think your problem is, how many objects it can detect. You have only given one argument which means that it assumes that you don't want to skip over anything(Which is true) but also that the maximum limit for how many things it can detect is 0.

Btw I could be wrong, I'm just guessing lol

This discussion is preserved as it was. New answers, comments, and votes are closed.