How do i will remove region? pls tell
One way is to create your own :Destroy() Function for the custom object like in the wiki:
However, since I believe the rotated region3 object has no events that you can just set the table to nil like so and wait for garbage collection:
local testRegion = RotatedRegion3.FromPart(sphere)
testRegion = nil
Please correct me if I’m wrong.
Hi, I was attempting to use your module for one of my moves, but I was struggling to get it to work properly. Here is the code
local RoadRollerHitbox = REGION3_HITBOX.Block(roadrollermod:GetModelCFrame() ,roadrollermod:GetModelSize())
local partsInRegion = workspace:FindPartsInRegion3(RoadRollerHitbox,50)
for i , v in pairs(partsInRegion) do
print("debugprint")
if v.Parent and v.Parent:FindFirstChildOfClass("Humanoid") and v.Parent:FindFirstChildOfClass("Humanoid").Health > 0 and (v.Parent:FindFirstChild("Torso")) then
if #AlreadyDamaged > 0 and table.find(AlreadyDamaged, v.Parent) then print("Prevents it from damaging twice")
else
local hum = v.Parent:FindFirstChildOfClass("Humanoid")
table.insert(AlreadyDamaged, hum.Parent)
damageevent:FireServer(hum, chr["Right Arm"].CFrame, 3, 0.4, rot.CFrame.lookVector * 0, "rbxassetid://241837157", 0.5, Color3.fromRGB(255, 0, 0), "rbxassetid://542443306", math.random(9, 11) / 10, math.random(9, 11) / 35, game.Players.LocalPlayer.PlayerGui.Blood.BloodVal.Value) --Handles damage.
knockevent:FireServer(hum) --Stuns player.
--end
end
end
end
I don’t work with Region 3 often so I believe I messed something up .
This error comes up when I try to use the code above: “Unable to cast Dictionary to Region3”. All help is appreciated!
Hmm, you are are creating the region 3 object as:
local RoadRollerHitbox = REGION3_HITBOX.Block(--stuff)
And I believe you need to use RotatedRegion3 Object methods to find the parts within the region instead of mixing it up with the Roblox’s workspace object methods workspace:FindPartsInRegion3 methods so you should do this:
local partsInRegion = RoadRollerHitbox:FindPartsInRegion3(Instance ignore, Integer maxParts)
Substitute the ignore and max parts according to the documentation and see if it works.
returns array of parts in the RotatedRegion3 object
will return a maximum number of parts in array [maxParts] the default is 20
parts that either are descendants of or actually are the [ignore] instance will be ignored
Will this work, or am I still doing it wrong?
local partsInRegion = RoadRollerHitbox:FindPartsInRegion3(chr:GetChildren(), math.huge)
Bruh this is so good and even easier to use than normal Region3
I think it was useful for its time, but it seems soon enough we’ll have something built in-engine to replace this!
I don’t know what I did wrong here, but this (server) script gets me a Argument 1 missing or nil
on line 210 on the RR3 API module, I’m not sure if I did something wrong or if it’s a bug.
Here’s the code:
local rotatedRegion = require(game:GetService("ServerStorage").Modules.RotatedRegion3)
local config = script.Parent.Configuration
local objectHealth = config.ObjectHealth
local objectMaxHealth = config.ObjectMaxHealth
local flammable = config.Flammable
local onFire = config.OnFire
local ignoreBullets = config.IgnoreBullets
local part = script.Parent
--local a = Vector3.new(part.Position.X-part.Size.X-0.1, part.Position.Y-part.Size.Y-0.1, part.Position.Z-part.Size.Z-0.1)
--local b = Vector3.new(part.Position.X+part.Size.X+0.1, part.Position.Y+part.Size.Y+0.1, part.Position.Z+part.Size.Z+0.1)
local region = rotatedRegion.Block(part.CFrame, part.Size)
local shards = math.floor(part.Size.X * part.Size.Y * part.Size.Z + 0.5)*8
local function updateRegion()
--a = Vector3.new(part.Position.X-part.Size.X, part.Position.Y-part.Size.Y, part.Position.Z-part.Size.Z)
--b = Vector3.new(part.Position.X+part.Size.X, part.Position.Y+part.Size.Y, part.Position.Z+part.Size.Z)
region = rotatedRegion.Block(part.CFrame, part.Size)
end
------------------------------------------------------------------------
while objectHealth.Value > 0 do
wait()
updateRegion()
local touchingParts = rotatedRegion:FindPartsInRegion3(part, 100)
for i, _part in pairs(touchingParts) do
local child = touchingParts[i]
if child:FindFirstChild("Configuration") then
print("Config")
if child:FindFirstChild("Configuration"):FindFirstChild("ObjectDamageValue") then
print("ObjectDamageValue")
objectHealth.Value -= child:FindFirstChild("Configuration"):FindFirstChild("ObjectDamageValue").Value
if objectHealth.Value <= 0 then
part.GlassShards:Emit(shards)
part.GlassShardsSmall:Emit(shards)
part.CanCollide = false
part.Transparency = 1
part.Shatter:Play()
break
end
end
end
end
end
Never used this module but I think the issue is that you are trying to call :FindPartsInRegion3 on the module itself instead of the Region.
local touchingParts = rotatedRegion:FindPartsInRegion3(part, 100)
to
local touchingParts = region:FindPartsInRegion3(part, 100)
Very very Clean! i love this module, thank you!
Is there a way to find the position the region3 intersected at?
Omg this is so easy to use, tysm.