Hey, i'm in need of a brick that hurts a player when and ONLY when the PLAYER is INSIDE of the brick. Kind of like a hurting fog; but, i do not want the user to die immediately, i want them to just receive pain until left the INSIDE of the brick. Thanks!
✓ ANSWER ACCEPTED
How do i make a pain region brick?
1 answer
✓ Accepted answer
Something like this might work inside the part:
local function CreateRegion3FromLocAndSize(Position, Size)
local SizeOffset = Size/2
local Point1 = Position - SizeOffset
local Point2 = Position + SizeOffset
return Region3.new(Point1, Point2)
end
local reg = CreateRegion3FromLocAndSize(script.Parent.Position,script.Parent.Size)
while wait(1) do
local parts = workspace:FindPartsInRegion3(reg,script.Parent,math.huge)
for i,v in pairs(parts) do
if v and v.Name == "HumanoidRootPart" and v.Parent:FindFirstChild("Humanoid") then
v.Parent.Humanoid:TakeDamage(5) --change for damage
end
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

7 comments
Hey, i tried putting the exact code above into a script inside of the brick and it didn't work...
Any errors?
No errors... it seems that the code doesn't work...
I’ve altered the script to work with Region3s instead of Touched, you can try that instead. Keep in mind, if you need the region to be rotated, you will have to use this: http://wiki.roblox.com/index.php?title=User:EgoMoose/Articles/Rotated_region3
Great Job man, Lastly is there any way that this could work inside of a model? I am planning on combining bricks together, and i dont want them to deal double damage when the user is inside the overlapping bricks? Thanks
Yeah dude whenever the bricks are overlapping one brick does 0 damage, one does like 3, whenever i have takedamage(1) in the script...
The easiest thing would be to not overlap the bricks.