For function in local script

for _, i in pairs(workspace.Area1Melons:GetChildren()) do
	if i:IsA("MeshPart") then
		i.Touched:Connect(function()
			i:Destroy()
		end)
	end
end

my script is not working and im idk why

Where is the script located?

Also it is not a function, this is a for loop.