=Overview=
So i have this script that gets all children of the workspaces than finds the child that is the child to certain items, once it finds the child it will check if it is close enough to the player, than proceed
=Problem=
Even though the item i wanted to be selected is in the workspace, it does not continue with the script [ No output errors Btw ]
=Script=
local everyting = game.Workspace:GetChildren()
print('starting') -- is printed
for i, v in ipairs(everyting) do
wait()
-- print(v.Parent) -- (when running this 'Workspace' was spammed in output )
if v.Parent == 'WoodenWaterFilter' or v.Parent == 'StoneWaterFilter' then
print('found suitable filter')--none of thep prints below are printed
local mag = (Torso.Position - v.Position).magnitude
if mag <= 15 and v.Parent.Storage.Value > 4 then
print('Filter is closes enough')
local Filter = v.Parent
local Watering = Item
Item.Thirst.Value = Filter.Thirst.Value + Item.Refill.Amount.Value
Filter.Storage.Value = Filter.Storage.Value - Item.Refill.Amount.Value
wait()
break
else
print('no filter with water close')
end
end
end

1 comment
I think I know why. On like 6, you check if it is a parent off the WoodenWaterFilter or StoneWaterFilter, but you're looping through the workspace. When looping through the workspace, the workspace will always be the parent.