i am working on a game with a placement system and for some reason the region3 responsible for collisions is not working when there is a player inside? also i am using the rotated region 3 module for my regions, because the normal is basically just more work and it doesnt work as well so here is the script and some screenshots
local boolTable = {}
local region2 = RR3.new(hitbox.CFrame,hitbox.Size - Vector3.new(0.1,0.1,0.1))
local parts2 = region2:FindPartsInRegion3()
for i,v in pairs(parts2) do
if v.Name == "Hitbox" and v ~= hitbox then
table.insert(boolTable,false)
end
end
if not table.find(boolTable,false) then
canPlace = true
else
canPlace = false
end
1 Like
I think you need to use a loop so it constantly checks the region3.
it is in a loop. i only put a part of the script responsible for the collisions. if you want i can send you the entire module but its like 800 lines long
Can you send an expanded version including the loop?
Have you tried debugging with prints or the studio built in debugging tool?
i’ll try to print every part inside the region3 and i’ll see what happens
i have added every characters body parts into a blacklist and it seems to work fine
heres the working script:
local boolTable = {}
local region2 = RR3.new(hitbox.CFrame,hitbox.Size - Vector3.new(0.1,0.1,0.1))
local ignorelist = {}
for i,v in pairs(game.Players:GetChildren()) do
for i,b in pairs(v.Character:GetChildren()) do
table.insert(ignorelist,b)
end
end
local parts2 = region2:FindPartsInRegion3WithIgnoreList(ignorelist)
for i,v in pairs(parts2) do
if v.Name == "Hitbox" and v ~= hitbox then
table.insert(boolTable,false)
end
end
if not table.find(boolTable,false) then
canPlace = true
else
canPlace = false
end
I dont think you need to add every part of the character as I believe if you just do Player.Character it adds the descendants.