local work = game.workspace
Deposit = work.Part.Deposit
local event = Instance.new("BindableEvent")
event.Parent = game.workspace.Events
event.Name = "Action"
local list = {work.Baseplate, work.Part}
local function CreateRegion3FromLocAndSize(Position, Size)
local SizeOffset = Size/2
local Point1 = Position - SizeOffset
local Point2 = Position + SizeOffset
Region = Region3.new(Point1, Point2)
return Region
end
local start_pos = work.Part.Position
local Size = Vector3.new(5, 2, 5)
CreateRegion3FromLocAndSize(start_pos, Size)
Region = Region:ExpandToGrid(4)
--work.Terrain:FillRegion(Region, 4, Enum.Material.Slate)
local parts = work:FindPartsInRegion3WithIgnoreList(Region, list, 10)
for i = 1, #parts do
print(parts[i].Name, " <- Part Name")
print(parts[i].Oil.Value, " <- Value of Reserve")
function Pumpy(action)
if action == true then
print("Pump Activated!")
else print("Pump Stopped!")
end
end
event.Event:Connect(Pumpy)
Deposit.Value = parts[i].Oil.Value
--print("Deposit ", Deposit.Value)
end
The idea is that this script goes inside a "Drill"(Part) that detects within his area of influence (Region3) if there is any reservoir beneath it. If it is, it will display on the screen the Value of the Reservoir. Other functions such as Pumpy are for the GUI.
The bug is that sometimes this works and finds the number, sometimes, even if the Reservoir its in the area, it doesn't show up the number and remains 0.
Moreover, if a "Drill" gets the number, newly spawned "Drills" will have that number even if they are far away from the Reservoir.
If this concept is wrong please feel free to share your opinions and ideas.
Thanks for everyone taking some time here.

3 comments
Storing the value of the oil in workspace is a bad idea, as it can be changed by exploiters/hackers. You should store them in ServerStorage, as localscripts cannot access ServerStorage.
If the game has FE on it doesn't matter where you store it, as long as a server script handles the value.
So if i handle that piece of code. Would i get that 'independence' from each Drill? I've been told to use tables but not sure how to do it. If anyone has a tutorial or some interesting reading. Please share it here